Rails flash messages with AJAX requests
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
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; |
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
# 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 |
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
# | |
# A virtual host using WordPress | |
# /etc/nginx/conf.d/example.com.conf | |
# | |
server | |
{ | |
listen 8080; | |
client_max_body_size 10m; | |
server_name .example.com; |
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
// 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; |
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
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 |
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 | |
/** | |
* Simple excel writer class with no external dependencies, drop it in and have fun | |
* @author Matt Nowack | |
* @license Unlicensed | |
* @version 1.0 | |
*/ | |
class Excel { | |
private $col; |
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 | |
COMPASS="/var/lib/gems/1.8/bin/compass" | |
case "$1" in | |
""|start) | |
echo "Starting compass watch..." | |
if [ -f ./cwatch.pid ] | |
then | |
echo "Sorry, but compass is already watching this folder..." |
駅データ.jp から以下のようなファイルをダウンロードし、 db/seeds/ekidata
とか適当な場所に置く:
- station20121102free.csv
- line20121030free.csv
- company20121010.csv
マイグレーション:
# db/migrate/XXXXXXXXXXXXXX_create_ekidata_stations.rb
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 | |
# | |
# データベース作成スクリプト. | |
# 引数に渡されたパスにデータベースを構成・データを投入する | |
# | |
# | |
# sample: | |
# sh createDatabaseAs.sh db.sqlite3 | |
# |
OlderNewer