Skip to content

Instantly share code, notes, and snippets.

View gouf's full-sized avatar
😇
I don't know how my life work with.

Go Furuya gouf

😇
I don't know how my life work with.
View GitHub Profile
@mungruby
mungruby / singleton_struct.rb
Created May 29, 2012 02:10
Avoiding redefining constant Struct::ClassName warnings
fields = [:switch, :sha_ind, :dtdm, :utdm, :ttdm, :actual]
def create_struct name, fields
Struct.new(name, *fields)
end
def create_singleton_struct name, fields
if Struct::const_defined? name
Struct.const_get name
else
@FGRibreau
FGRibreau / times.js
Created February 5, 2012 22:45
Ruby .times & .upto & .downto methods in JavaScript
// Ruby = 5.times { |i| puts i }
// JS = (1).times(function(i){console.log(i);})
Number.prototype.times = function(cb) {
var i = -1;
while (++i < this) {
cb(i);
}
return +this;
@miya0001
miya0001 / example.com.conf
Created October 14, 2011 08:44
nginx+リバースプロキシでバーチャルホスト
#
# A virtual host using WordPress
# /etc/nginx/conf.d/example.com.conf
#
server
{
listen 8080;
client_max_body_size 10m;
server_name .example.com;
@nukemberg
nukemberg / knife.sh
Created June 28, 2011 07:51 — forked from ches/knife
bash completion for Chef's knife command (updated for 0.10)
# vim: ft=sh:ts=4:sw=4:autoindent:expandtab:
# Author: Avishai Ish-Shalom <avishai@fewbytes.com>
# We need to specify GNU sed for OS X, BSDs, etc.
if [[ "$(uname -s)" == "Darwin" ]]; then
SED=gsed
else
SED=sed
fi
@rdegges
rdegges / proxy_nginx.sh
Created April 11, 2011 05:30
Create a HTTP proxy for jenkins using NGINX.
sudo aptitude -y install nginx
cd /etc/nginx/sites-available
sudo rm default
sudo cat > jenkins
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;