This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$time = '03/2014'; | |
$dt1 = \DateTime::createFromFormat('m/Y', $time); // "2014-03-19 17:14:38" | |
$dt2 = \DateTime::createFromFormat('!m/Y', $time); // "2014-03-01 00:00:00" | |
$dt3 = \DateTime::createFromFormat('m/Y!', $time); // "1970-01-01 00:00:00" | |
$dt4 = \DateTime::createFromFormat('m!/Y', $time); // "2014-01-01 00:00:00" | |
var_dump($dt1, $dt2, $dt3, $dt4); | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start the old vagrant | |
$ vagrant init centos-6.3 | |
$ vagrant up | |
# You should see a message like: | |
# [default] The guest additions on this VM do not match the install version of | |
# VirtualBox! This may cause things such as forwarded ports, shared | |
# folders, and more to not work properly. If any of those things fail on | |
# this machine, please update the guest additions and repackage the | |
# box. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Greeter { | |
func greet() -> String | |
} | |
protocol エンジニャー { | |
func meo() | |
} | |
class Person: Greeter { | |
var name: String = "kitamura" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gdb) continue | |
Continuing. | |
Program received signal SIGSEGV, Segmentation fault. | |
0x000000000070ff48 in zend_std_object_get_class (object=0x35cfb78) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_object_handlers.c:1499 | |
1499 /build/buildd/php5-5.5.9+dfsg/Zend/zend_object_handlers.c: No such file or directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def changed(file_path) | |
notify File.open(file_path, "rb").read | |
end | |
def notify(result) | |
messages = result.split("\n") | |
title = messages.shift | |
group = messages.shift | |
info = messages.join("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream backend { | |
server 127.0.0.1:3001; | |
} | |
# http://henteco-labs.com/labs/2014/04/14/rails-nginx/ | |
server { | |
location / { | |
try_files $uri @proxy; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream backend { | |
server unix:/home/vagrant/prj/blog/tmp/sockets/puma.sock; | |
} | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /home/vagrant/prj/blog/public; | |
index index.html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
while (false !== $line = fgets(STDIN)) { | |
print_r(parse($line)); | |
} | |
// 68 sec | |
function parse($line) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP CLI Colors – PHP Class Command Line Colors (bash) | |
* | |
* $str = "This is an example "; | |
* | |
* foreach (ColorCLI::$foregroundColors as $fg => $fgCode) { | |
* echo ColorCLI::$fg($str); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Satooshi; | |
/** | |
* Short description. | |
* | |
* Long description. | |
*/ | |
class Test | |
{ |
OlderNewer