Skip to content

Instantly share code, notes, and snippets.

View dribble13's full-sized avatar

キシカミコウイチ dribble13

View GitHub Profile
@dribble13
dribble13 / launchd.conf
Created December 6, 2013 11:32
Mac OSXでファイルディスクリプタの上限数を変える ref: http://qiita.com/dribble13/items/d98113179a0ce5b97e77
# 下記2行を追加 (ファイルがなければ作成)
limit maxfiles 8192 20480
limit maxproc 1000 2000
@dribble13
dribble13 / file0.js
Last active December 26, 2015 04:58
ブラウザ側で日時指定で、リダイレクト先を切り替えるスクリプト ref: http://qiita.com/dribble13/items/cd5aa40d87d1e993bb51
$(document).ready(function() {
$('a.location_timer').each(function(index, target) {
var startDate = $(this).attr('data-start-date');
var endDate = $(this).attr('data-end-date');
var nowDate = new Date();
startDate = startDate ? new Date(startDate) : nowDate;
endDate = endDate ? new Date(endDate) : null;
if (startDate <= nowDate && (!endDate || nowDate <= endDate)) {
@dribble13
dribble13 / file0.txt
Created September 26, 2013 06:50
simple_form_forでネームスペースを指定する ref: http://qiita.com/dribble13/items/baa46f593f416fbd842b
namespace :admin do
resources :resources
end
@dribble13
dribble13 / file0.js
Last active December 23, 2015 19:09
ブラウザ側で日時指定で表示・非表示を切り替えるスクリプト ref: http://qiita.com/dribble13/items/3eb39726aba33add6c0a
$(document).ready(function() {
$(".view_timer").each(function(index, target) {
var startDate = $(this).attr("start_date");
var endDate = $(this).attr("end_date");
var nowDate = new Date();
if (startDate) {
startDate = new Date(startDate);
}
else {
@dribble13
dribble13 / gist:3910105
Created October 18, 2012 05:56
thor namespace sample 3
module Foo
class Hoge < Thor
# namespace :foo
desc "hoge", "hogehoge!!"
method_option :delete_flg, :type => :boolean, :aliases => "-d"
def hoge()
p "hoge"
end
end
@dribble13
dribble13 / gist:3910101
Created October 18, 2012 05:54
thor namespace sample 4
module Foo
class Fuga < Class
# namespace :foo
desc "fuga", "fugafuga"
method_option :delete_flg, :type => :boolean, :aliases => "-d"
def fuga()
p "fuga"
end
end
@dribble13
dribble13 / gist:3910078
Created October 18, 2012 05:45
thor namespace sample 2
class Fuga < Class
namespace :foo
desc "fuga", "fugafuga"
method_option :delete_flg, :type => :boolean, :aliases => "-d"
def fuga()
p "fuga"
end
end
@dribble13
dribble13 / gist:3910052
Created October 18, 2012 05:40
thor namespace sample 1
class Hoge < Thor
namespace :foo
desc "hoge", "hogehoge!!"
method_option :delete_flg, :type => :boolean, :aliases => "-d"
def hoge()
p "hoge"
end
end
@dribble13
dribble13 / backup.sh
Created October 18, 2012 05:16
Mysql backup script
#!/bin/bash
# ブログバックアップスクリプト
# mysqlのアカウント情報
BLOG_USER=scott
BLOG_PASS=tiger
# WORDPRESSのディレクトリ
WORDPRESS_DIR=/var/www/blog
# バックアップ先Dirと保存する期間
BACKUP_DIR=/home/hoge/Dropbox/blog
BACKUP_DATE="+10"
@dribble13
dribble13 / gist:3256199
Created August 4, 2012 09:01
unicorn init script with rbenv
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts unicorn
# Description: starts uniconr using start-stop-daemon