Skip to content

Instantly share code, notes, and snippets.

takuya_yamamoto tarunama

  • Web Engineer
  • TOKYO,JAPAN
Block or report user

Report or block tarunama

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View map_sample.py
items = ["2", "4", "8"]
for r in map(int, items):
print(isinstance(r, int))
"""
output
True
True
True
View これでも問題なく動く
<?PHP
$content = fopen($argv[1], "r");
while (($line = fgets($content)) !== false) {
$ary = preg_split("/[\s]/", $line);
$str = $ary[1];
$pattern = preg_split("/[\\+\-]/", $ary[1]);
foreach (str_split($pattern[0]) as $val) {
@tarunama
tarunama / first_char.php
Created May 22, 2014
[PHP] 文字列の1文字目を大文字にする ref: http://qiita.com/tarunama/items/2bb5ff9ff1556d61e526
View first_char.php
foreach ($ary as $val) {
$val[0] = strtoupper($val[0]);
....
}
View TypeHinting.php
<?php
$data = array();
$data[] = 'hoge';
$data[] = 'foo';
// この間50行くらい
// あ、$dataは配列なのか、と想定してコード読める
function typeHinting(array $data)
@tarunama
tarunama / trait_A.php
Created Sep 30, 2014
[PHP] traitを使うとよいことがあるらしい ref: http://qiita.com/tarunama/items/32255aab1f777287eaac
View trait_A.php
<?php
trait Access
{
public function destination($to_where)
{
echo $to_where;
}
}
View abstract.php
<?php
abstract class Working
{
abstract protected function where();
abstract protected function why();
abstract protected function how();
public function work()
{
@tarunama
tarunama / abstract.php
Last active Aug 29, 2015
[PHP]抽象クラスとTraitのコードを見比べる。 ref: http://qiita.com/tarunama/items/694c790101eacf759500
View abstract.php
<?php
abstract class Working
{
abstract protected function where();
abstract protected function why();
abstract protected function how();
public function work()
{
@tarunama
tarunama / PHPの場合
Last active Aug 29, 2015
[Scala]PHPerのScala入門メモ(途中) ref: http://qiita.com/tarunama/items/f30420fa117c84274e1b
View PHPの場合
trait Access {
function howTo() {
echo "HowTo";
}
}
class Company {
use Access;
}
$access = new Company();
$access->howTo(); // HowTo
@tarunama
tarunama / file0.js
Last active Aug 29, 2015
[JavaScript] jQueryのメソッドにCallback関数を適応させる時のメモ ref: http://qiita.com/tarunama/items/7e5d1a6c5794c478a950
View file0.js
// main
$("#hoge").click(function () {
console.log("function main start");
// 適当なメソッド
console.log("method animate start");
var value;
$("#foo").animate({
right: 100
@tarunama
tarunama / file0.js
Created Jan 11, 2015
[JavaScript] exit()的なことがしたい時 ref: http://qiita.com/tarunama/items/0b2eb347f3f92f4c5e3a
View file0.js
for (var i=0; i < 10; i++)
{
console.log(hoge);
// returnで無理矢理処理を終わらせる
return;
// ここら辺でエラーでる
if (hoge < 10) return true;
}
You can’t perform that action at this time.