Skip to content

Instantly share code, notes, and snippets.

Takashi Chiba tachiba

Block or report user

Report or block tachiba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View raven-config.html
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
View specs.rb
# post_concatnator_spec.rb
# encoding: utf-8
require 'spec_helper'
module Moge
class PostString
def initialize
@body = 'hogehoge'
@nickname = 'mogemoge'
end
View raise_nil.rb
raise nil
#= > TypeError: exception object expected
@tachiba
tachiba / resolve_replace_patch_for_ruby_2_0_0.rb
Created May 5, 2013
monkeypatch for resolve-replace on ruby2.0.0p0
View resolve_replace_patch_for_ruby_2_0_0.rb
# SEE: http://www.ruby-forum.com/topic/4411796
class TCPSocket < IPSocket
def initialize(host, serv, *rest)
rest[0] = IPSocket.getaddress(rest[0]) if rest[0]
#rest[0] = IPSocket.getaddress(rest[0]) unless rest.empty?
original_resolv_initialize(IPSocket.getaddress(host), serv, *rest)
end
end
@tachiba
tachiba / gitlab_resque.rb
Created Jan 29, 2013
god > gitlab-resuqe
View gitlab_resque.rb
app_root = "/home/gitlab/gitlabhq"
# SEE: https://github.com/defunkt/resque/blob/master/examples/god/resque.god
God.watch do |w|
w.name = "gitlab-resque"
w.interval = 30.seconds
w.dir = app_root
w.env = {
"QUEUE" => 'post_receive,mailer,system_hook',
@tachiba
tachiba / gitlab.rb
Created Jan 29, 2013
god > gitlab.rb
View gitlab.rb
app_root = "/home/gitlab/gitlabhq"
God.watch do |w|
w.name = "gitlab"
w.interval = 30.seconds
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.dir = app_root
w.env = {
View rails_admin_without_devise.md

Using rails_admin without devise

Having a buckload of code to authorize users on your application is something you may like or not. Speaking for myself I hate it. But I still love rails_admin, here's how you install it without devise. Thanks to phoet for providing the hints in the gist I have forked from.

Add RailsAdmin to your Gemfile

do NOT add devise

gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"
View base.rb
require 'open-uri'
require 'timeout'
require 'resolv-replace'
require 'mechanize'
module Parser
module Base
attr_reader :current_html, :agent
USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6"
View monitor-redis.rb
# Redis
%w{6379}.each do |port|
God.watch do |w|
w.name = "redis"
w.interval = 30.seconds
w.start = "/etc/init.d/redis start"
w.stop = "/etc/init.d/redis stop"
w.restart = "/etc/init.d/redis restart"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
@tachiba
tachiba / default.conf
Created Aug 3, 2012
Elastic Load Balancer's health check on nginx
View default.conf
#
# The default server
#
server {
listen 80;
server_name _;
# ELB health check!
location ~ ^/health/(.+)$ {
proxy_pass http://$1_production/health;
You can’t perform that action at this time.