Skip to content

Instantly share code, notes, and snippets.

@rightgo09
rightgo09 / time_parse.rs
Created May 5, 2022 01:32
Parse unixtime in Rust
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;
}
class Hoge
def get_v
@@v ||= 123
end
class << self
def inc_v
@@v ||= 0
@@v += 1
end
$ 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/
<?php
class ArrayOptionNoSuchElementException extends ErrorException {}
class ArrayOption
{
private $v;
public function __construct($v)
{
<?php
class Any implements IteratorAggregate
{
private $v;
public function __construct($v)
{
$this->v = $v;
}
public function __get($name)
{
module HogeTrait
def h
res = super
puts "HogeTrait::h() dayo"
res['t'] = 'traitdayo'
res
end
end
class ParentHoge
<?php
$start_time=microtime(true);
$sum = 0;
foreach (range(0, 1000000) as $val) {
$sum += $val;
}
echo $sum.PHP_EOL;
$end_time = microtime(true);
<?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);
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
<?php
class Hoge {
public $foo;
public function __construct(&$foo) {
$this->foo =& $foo;
}
public function &get_foo() {
return $this->foo['bar'];
}
public function aaa() {