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
var http = require('http'); | |
http.createServer(function(req, res){ | |
var i = 0; | |
var id = 100 * Math.random() | 0; | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
setInterval(function(){ | |
var result = id + ':' + ++i; | |
console.log(result); |
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
console.log(typeOf(undefined)); //'undefined' | |
console.log(typeOf(null)); //'null' | |
console.log(typeOf("str")); //'string' | |
console.log(typeOf(new String("str"))); //'String' | |
console.log(typeOf(true)); //'boolean' | |
console.log(typeOf(new Boolean(true))); //'Boolean' | |
console.log(typeOf(1)); //'number' | |
console.log(typeOf(NaN)); //'NaN' | |
console.log(typeOf(Infinity)); //'Infinity' | |
console.log(typeOf(-Infinity)); //'-Infinity' |
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 | |
$a1 = [10,20,30]; //配列っぽい配列 | |
$a2 = [2=>10, 0=>20, 1=>30]; //添え字は整数だが順番が変な配列 | |
$a3 = ['a'=>10, 20, 30]; //添え字に文字列が混じってる |
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
var_dump(explode(' ', '')); | |
//array("") |
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 FactoryDefault | |
{ | |
function createInfrastructureMailer() | |
{ | |
return new SendmailMailer; | |
} | |
function createDomainTransferNewsletter() | |
{ |
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 A { | |
public $hoge = 1; | |
public $fuga = 2; | |
private $pri = 3; | |
protected $pro = 4; | |
} | |
$a = new A; |
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
$ mkdir some-project | |
$ cd some-project | |
$ composer require 'zendframework/zend-log:*' |
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 CurlStream | |
{ | |
/** @type resource $context */ | |
public $context; | |
/** @type resource<url>[] */ | |
private static $cache = array(); |
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
--- sort.js 2011-06-29 23:34:27.000000000 +0900 | |
+++ sort2.js 2011-06-29 23:34:37.000000000 +0900 | |
@@ -1,10 +1,10 @@ | |
var sort = function(list, comparer) { | |
- if (!comparer) comparer = function(x, y) { return y - x; }; | |
+ if (!comparer) comparer = function(x, y) { return x - y; }; | |
return (function self(list) { | |
if (list.length < 2) return list; | |
var left = self(list.splice(0, list.length >>> 1)), right = self(list.splice(0)); | |
while (left.length && right.length) |
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 | |
require_once 'Zend/Rest/Client.php'; | |
//アプリケーションIDは各自で取得したものを使ってください。 | |
$appid = 'プレミアム検索対応のアプリケーションIDをここに記入'; | |
//APIのベースURLを指定する | |
$client = new Zend_Rest_Client('http://search.yahooapis.jp/PremiumWebSearchService/V1/webSearch'); | |
//パラメータを設定 |
OlderNewer