Skip to content

Instantly share code, notes, and snippets.

View kkosuge's full-sized avatar
🐇
busy

Kosuge Kazuya kkosuge

🐇
busy
View GitHub Profile
#footer {
left: auto;
bottom: 0px;
right: 0;
width: 500px;
height: 100%;
}
#info_playlist_frame_left {
height: 100%;
application = "example"
environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production'
app_path = "/usr/local/rails/#{application}"
shared_path = "#{app_path}/shared/"
timeout 30
preload_app true
worker_processes 3
listen "/tmp/unicorn-#{application}.sock"
@kkosuge
kkosuge / gist:5847861
Created June 24, 2013 05:13
Macbook Pro Retina のディスプレイ情報
ioreg -lw0 | grep EDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
class Neko
nyan: =>
@_nyan || do =>
alert 'nyan'
@_nyan = true
neko = new Neko
neko.nyan() #=> alert 'nyan' & true
neko.nyan() #=> true
_.mixin
sample: (count, array) ->
if !array
array = count
count = 1
sample = Array(count)
_(count).times (i) -> sample[i] = (array[Math.floor(Math.random() * array.length)])
return sample
@kkosuge
kkosuge / m.rb
Last active December 14, 2015 15:09
Hashie::Mash のデフォルトをエラーにするやつ
# coding: utf-8
require 'hashie'
hash = {:foo => 1, "bar" => {:baz => 2}}
m = Hashie::Mash.new(hash, nil) do |_, method_name|
raise NoMethodError, "undefined method `#{method_name}'", caller(5)
end
puts m.foo #=> 1
puts m.bar.baz #=> 2
require "open-uri"
require "nokogiri"
require "pp"
base_url = "http://dribbble.com"
@file = File.open('dribbble_profile_urls.txt','w')
def get_web_link(url)
doc = Nokogiri::HTML(open(url))
doc.css('.profile-details .url').each do |link|
load 'deploy/assets'
namespace :deploy do
namespace :assets do
desc 'Run the precompile task locally and rsync with shared'
task :precompile, :roles => :web, :except => { :no_release => true } do
%x{bundle exec rake assets:precompile}
%x{rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}}
%x{bundle exec rake assets:clean}
end
@kkosuge
kkosuge / unicorn
Last active December 11, 2015 12:39 — forked from mguterl/gist:308216
#!/bin/sh
set -u
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
APP_ROOT=/home/deploy/public_html/rm/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENV=production
@kkosuge
kkosuge / Gemfile
Last active December 11, 2015 01:19
source 'https://rubygems.org'
gem 'chatroid'
gem 'im-kayac'