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
// JSでN個の非同期処理を同期的に実行したい場合の例。 | |
// 1つめの非同期処理が終わったら2つ目に。2つ目が終わったら3つ目に。そして、いくつあるかは場合による。という状況。 | |
var functions = [ | |
function () { | |
var deferred = Q.defer(); | |
// 何らかの処理。遅延してdeferred.resolve()される。 | |
return deferred.promise; |
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
#!/bin/sh | |
# | |
# /etc/rc.d/init.d/supervisord | |
# sudo chkconfig --add supervisord | |
# sudo chkconfig --level 35 supervisord on | |
# | |
# chkconfig: - 64 36 | |
# description: Supervisor Server | |
# processname: supervisord |
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
#!/bin/sh | |
# | |
# /etc/rc.d/init.d/supervisord | |
# sudo chkconfig --add supervisord | |
# sudo chkconfig --level 35 supervisord on | |
# | |
# chkconfig: - 64 36 | |
# description: Supervisor Server | |
# processname: supervisord |
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
diff --git a/app/config/app.php b/app/config/app.php | |
index 10ae94b..f7a798f 100644 | |
--- a/app/config/app.php | |
+++ b/app/config/app.php | |
@@ -121,6 +121,7 @@ return array( | |
'Illuminate\Validation\ValidationServiceProvider', | |
'Illuminate\View\ViewServiceProvider', | |
'Illuminate\Workbench\WorkbenchServiceProvider', | |
+ 'App\ServiceProvider', | |
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
#!/usr/bin/php | |
<?php | |
// @see https://gist.github.com/raphaelstolt/588697 | |
printf("%sGit pre-commit hook %1\$s", PHP_EOL); | |
putenv('PATH=/usr/local/bin'); | |
$projectRoot = getcwd(); | |
$projectName = basename($projectRoot); | |
$run = function ($projectName, $command) { |
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
#!/bin/bash | |
# Installation: | |
# 1. Save this script to /some/bin/ssh-background | |
# 2. chmod 755 /some/bin/ssh-background | |
# 3. alias ssh=/some/bin/ssh-background | |
# 4. Configure your host colors below. | |
set_color() { | |
local HEX_FG=$1 | |
local HEX_BG=$2 |
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
diff --git a/Vagrantfile b/Vagrantfile | |
index 11320e1..6eee250 100644 | |
--- a/Vagrantfile | |
+++ b/Vagrantfile | |
@@ -10,11 +10,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# please see the online documentation at vagrantup.com. | |
# Every Vagrant virtual environment requires a box to build off of. | |
- config.vm.box = "base" | |
+ config.vm.box = "ubuntu1304" |
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
[ *.{rb,erb} ] | |
softTabs = true | |
tabSize = 2 |
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
Model_Profile::query() | |
->and_where_open()->where('id', 'like', '%foo%')->or_where('user_id', 'like', '%foo%')->and_where_close() | |
->and_where_open()->where('id', 'like', '%bar%')->or_where('user_id', 'like', '%bar%')->and_where_close() | |
->get(); | |
// WHERE (`t0`.`id` LIKE '%foo%' OR `t0`.`user_id` LIKE '%foo%') AND (`t0`.`id` LIKE '%bar%' OR `t0`.`user_id` LIKE '%bar%') | |
Model_Profile::find('all', array('where' => array( | |
// 当たり前だが'or'を複数指定しても最後のしか残らない |
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
/** | |
* Log to chrome | |
* | |
* required Chrome Logger | |
* https://chrome.google.com/webstore/detail/chrome-logger/noaneddfkdjfnfdakjjmocngnfkfehhd | |
* | |
* @param mixed $message | |
* @param string $logger | |
* @return boolean | |
*/ |
NewerOlder