Skip to content

Instantly share code, notes, and snippets.

View 1syo's full-sized avatar

Kazunari Takahashi 1syo

View GitHub Profile
@1syo
1syo / post-receive
Last active December 14, 2015 12:48
#!/usr/bin/env bash
. $HOME/.bashrc
. $HOME/.rvm/scripts/rvm
NOW=`date "+%Y%m%d%H%M%S"`
# set up target directories
CURRENT_DIR=$HOME/apps/current
RELESE_DIR=$HOME/apps/releases/$NOW
module Jekyll
class Foo < Liquid::Tag
def render(context)
context.registers[:site].config["your_config_var"]
end
end
end
Liquid::Template.register_tag('foo', Jekyll::Foo)
# A sample Gemfile
source "https://rubygems.org"
gem "rails", "4.0.0.beta1"
class C
attr_accessor :m
def initialize(&block)
instance_eval(&block)
end
end
x = "hoge"
c = C.new { self.m = x }
@1syo
1syo / gist:5718814
Last active December 18, 2015 03:29
def book_title
book_title_lookup(@isbn, @isbn_typ)
end
private
def book_title_lookup(isbn, isbn_type)
response = @client.item_lookup do
category 'Books'
id isbn
id_type isbn_type
VCR.configure do |c|
c.cassette_library_dir = 'spec/factories/vcr_cassettes'
c.allow_http_connections_when_no_cassette = true
c.hook_into :webmock
c.default_cassette_options = {
:match_requests_on => [:query, VCR.request_matchers.uri_without_param(:Timestamp)]
}
end
@1syo
1syo / gist:6060591
Last active December 20, 2015 02:59
namespace :admin do
task :host01 => :environment do
set :rails_env, :production
set :deploy_to, '/home/admin/apps'
set :domain, 'admin01'
end
task :host02 => :environment do
set :rails_env, :production
set :deploy_to, '/home/admin/apps'
@1syo
1syo / test_run.sh
Last active December 24, 2015 17:29
#!/bin/bash
export DEPLOY=true
export WERCKER_AIRBRAKE_NOTIFY_API_KEY=1qazxsw23edcvfr4
export WERCKER_AIRBRAKE_NOTIFY_HOST=example.com
export WERCKER_AIRBRAKE_NOTIFY_SECURE=true
#export WERCKER_AIRBRAKE_NOTIFY_ENVIRONMENT=preview
export WERCKER_AIRBRAKE_NOTIFY_MESSAGE=OK
export WERCKER_GIT_DOMAIN=github.com
export WERCKER_GIT_OWNER=1syo
mkdir -p config/deploy
create config/deploy.rb
create config/deploy/staging.rb
create config/deploy/production.rb
mkdir -p lib/capistrano/tasks
Capified
#! /bin/sh
host=localhost
database=db
user=dbuser
password=password
from_date=`date --date '1 days ago' +\%Y-\%m-\%d`
to_date=`date +\%Y-\%m-\%d`
[email protected]