Skip to content

Instantly share code, notes, and snippets.

View hayatravis's full-sized avatar

Hayato Sugawara hayatravis

  • SHA
  • Tokyo, Japan
View GitHub Profile
@hayatravis
hayatravis / gist:9135a7d8e0a4b1688da7
Last active September 23, 2015 09:41
docker: ubuntu14.04 unable install redis-server
# apt-get install python-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-software-properties is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
software-properties-common
<?php
function test($max) {
for ($i = 1; $i <= $max; $i++) {
if ($i <= 1) {
continue;
}
if ($i == 2) {
print $i . "\n";
continue;
}
@hayatravis
hayatravis / json_enconde_jp.php
Created November 27, 2013 03:45
json_encode($array,JSON_UNESCAPED_UNICODE) For PHP5.3. Except json encoding japanese For php5.3. php5.3のjson_encodeで日本語をエンコードさせない関数。
function json_encode_jp($array) {
return preg_replace_callback(
'/\\\\u([0-9a-zA-Z]{4})/',
function ($matches) {
return mb_convert_encoding(pack('H*',$matches[1]),'UTF-8','UTF-16');
},
json_encode($array)
);
}