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
# | |
# Description: | |
# Watch and emit github events. | |
# see https://developer.github.com/v3/activity/events/types/ | |
# | |
# Dependencies: | |
# cron, request, config, lodash | |
# | |
# Configuration: | |
# config.github.organizations 監視したいgheのorg名をキーとするオブジェクト |
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
express = require 'express' | |
request = require 'request' | |
app = express() | |
app.get '/', (req, res) -> res.send 'test!!!' | |
mockHttpServer = app.listen 3011, -> | |
request 'http://localhost:3011', (err, res, body) -> | |
console.log body | |
mockHttpServer.close() |
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
me = new MutualExclusion; | |
var hogeProcess = function(args, done) { | |
me.do(function(done) { | |
someAsync(function(err, result) { | |
done(err, result); | |
}); | |
}, done); | |
} |
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
# | |
# Description: | |
# Add hubot icon to bot message. | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# |
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
# Description: | |
# Force hubot hearing messages only in rooms. | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
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 test_repo | |
cd test_repo | |
git init | |
touch test.txt | |
git add . | |
git commit -m 'initial commit' | |
echo hoge >> test.txt | |
git add . | |
git commit -m 'second commit' | |
git 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
# Description: | |
# Show qr-code. | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
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 | |
preg_match('/^[0-9]+$/', $hoge); | |
preg_match('/^[a-zA-Z0-9_\-]+$/', $hoge); |
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 | |
$LOG_FILE = dirname(__FILE__).'/hook.log'; | |
$SECRET_KEY = '** secret **'; | |
if ( isset($_GET['key']) && $_GET['key'] === $SECRET_KEY && isset($_POST['payload']) ) { | |
$payload = json_decode($_POST['payload'], true); | |
if ($payload['ref'] === 'refs/heads/master') { | |
`cd /path/to/repository; git pull origin master`; | |
file_put_contents($LOG_FILE, date("[Y-m-d H:i:s]")." ".$_SERVER['REMOTE_ADDR']." git pulled: ".$payload['head_commit']['message']."\n", FILE_APPEND|LOCK_EX); |
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 Sprite = function(){ | |
this.x = 0; | |
this.v = 0.5; | |
}; | |
// x方向に引数で与えた分だけ速度vで進む | |
Sprite.prototype.move = function(x) { | |
var time = x / this.v; | |
for (var i = 0; i < time; i++) { | |
this.x += this.v; | |
yield; |
NewerOlder