Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tachiba on github.
  • I am tachiba (https://keybase.io/tachiba) on keybase.
  • I have a public key ASAgFz1i_EOgBjjd0Vu-U4QzU9873NCo7U9bn-uzVoGdlwo

To claim this, I am signing this object:

<!-- 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',
# post_concatnator_spec.rb
# encoding: utf-8
require 'spec_helper'
module Moge
class PostString
def initialize
@body = 'hogehoge'
@nickname = 'mogemoge'
end
raise nil
#= > TypeError: exception object expected
@tachiba
tachiba / resolve_replace_patch_for_ruby_2_0_0.rb
Created May 5, 2013 11:25
monkeypatch for resolve-replace on ruby2.0.0p0
# 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 January 29, 2013 10:35
god > gitlab-resuqe
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 January 29, 2013 10:33
god > 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 = {

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"

@tachiba
tachiba / base.rb
Created October 18, 2012 04:57
parser base
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"
# 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