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
use std::env; | |
use chrono::prelude::DateTime; | |
fn main() { | |
let args: Vec<String> = env::args().collect(); | |
if args.len() < 2 { | |
println!("argument is unixtime"); | |
return; | |
} |
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
class Hoge | |
def get_v | |
@@v ||= 123 | |
end | |
class << self | |
def inc_v | |
@@v ||= 0 | |
@@v += 1 | |
end |
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
$ unzip typesafe-activator-1.3.7-minimal.zip | |
$ mv ~/Downloads/activator-1.3.7-minimal ~/local | |
$ ln -s ~/local/activator-1.3.7-minimal/activator ~/bin/activator | |
$ chmod +x ~/local/activator-1.3.7-minimal/activator | |
$ mkdir play2.4.6_test | |
$ cd play2.4.6_test/ |
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 | |
class ArrayOptionNoSuchElementException extends ErrorException {} | |
class ArrayOption | |
{ | |
private $v; | |
public function __construct($v) | |
{ |
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 | |
class Any implements IteratorAggregate | |
{ | |
private $v; | |
public function __construct($v) | |
{ | |
$this->v = $v; | |
} | |
public function __get($name) | |
{ |
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
module HogeTrait | |
def h | |
res = super | |
puts "HogeTrait::h() dayo" | |
res['t'] = 'traitdayo' | |
res | |
end | |
end | |
class ParentHoge |
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 | |
$start_time=microtime(true); | |
$sum = 0; | |
foreach (range(0, 1000000) as $val) { | |
$sum += $val; | |
} | |
echo $sum.PHP_EOL; | |
$end_time = microtime(true); |
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 | |
$a = array(1,2,3); | |
$b = array(4,5,6); | |
foreach (array($a, &$b) as &$c) { | |
foreach ($c as &$d) { | |
$d *= 100; | |
} | |
} | |
print_r($a); | |
print_r($b); |
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
arr = [11,12,13,14,15,16,17,18] | |
arr.partition{|a|a.odd?}.flatten.each{|c|puts c} | |
#=> 11 | |
#=> 13 | |
#=> 15 | |
#=> 17 | |
#=> 12 | |
#=> 14 | |
#=> 16 | |
#=> 18 |
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 | |
class Hoge { | |
public $foo; | |
public function __construct(&$foo) { | |
$this->foo =& $foo; | |
} | |
public function &get_foo() { | |
return $this->foo['bar']; | |
} | |
public function aaa() { |
NewerOlder