Skip to content

Instantly share code, notes, and snippets.

View wan2land's full-sized avatar
👾

Changwan Jun wan2land

👾
View GitHub Profile
<?php
namespace Your\Owns;
use Wandu\DI\Container;
use Wandu\DI\ContainerInterface;
class Application extends Container
{
/** @var \Wandu\DI\ContainerInterface */
public static $instance;
@wan2land
wan2land / benchmark.php
Created July 24, 2014 03:12
php compare benchmark
<?php
function benchmark( $callback, $times = 100 ) {
if ( !($callback instanceof Closure) ) return false;
$st = explode(" ", microtime());
for ($i = 0; $i < $times; $i++) {
$ret = $callback( $i );
}
$et = explode(" ", microtime());
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@wan2land
wan2land / wgit
Last active August 29, 2015 14:02
wgit.php
#!/usr/bin/env php
<?php
/**
* Base On wan2land/wandu-console
*/
use \Wandu\Console\Argv;
use \Wandu\Console\Request;
use \Wandu\Console\Response;
require __DIR__.'/../vendor/autoload.php';
@wan2land
wan2land / deployer
Last active August 29, 2015 14:02
global deployer
#!/usr/bin/env php
<?php
echo "Load Deploy :)\n---------------------------------------\n";
require __DIR__.'/../vendor/autoload.php';
deployer();
$file_path = $_SERVER['PWD'].'/deployer.php';
if ( file_exists( $file_path ) ) {
@wan2land
wan2land / composer.json
Created June 12, 2014 02:47
globally composer.json
{
"repositories" : [
{
"type" : "pear",
"url" : "http://pear.php.net"
}
],
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpdocumentor/phpdocumentor": "2.*",
//참고 : http://jsperf.com/count-the-number-of-characters-in-a-string
//www.lsauer.com 2012
//Answer to:
//http://stackoverflow.com/questions/881085/count-the-number-of-occurances-of-a-character-in-a-string-in-javascript/10671743#10671743
//There are at least four ways. The best option, which should also be the fastest -owing to the native RegEx engine -, is placed at the top. //jsperf.com is currently down, otherwise I would provide you with performance statistics.
#1.
("this is foo bar".match(/o/g)||[]).length
//>2
@wan2land
wan2land / .bash_profile
Last active August 29, 2015 14:01
Global Composer Setting
export PATH="~/.composer/vendor/bin:$PATH" #vendor들의 바이너리 포함.
export PATH="~/.composer/bin:$PATH" # 혹시 필요에 따라서 만들 바이너리 포함. 여기서는 deployer때문에 사용.