Skip to content

Instantly share code, notes, and snippets.

View jarinudom's full-sized avatar

Jarin Udom jarinudom

View GitHub Profile
ActiveAdmin.register Profile do
controller do
def scoped_collection
end_of_association_chain.visible.include(:photos)
end
end
end
#!/usr/bin/ruby -w
require 'digest/md5'
filename = 'myimage.png'
# Generate a hash from the file contents
digest = Digest::MD5.hexdigest(File.read(filename))
# Mersenne Twister RNG with seed
prng = Random.new(digest)
color molokai
let g:molokai_original=0
set gfn=Inconsolata:h16
" Press F4 for MAGIC INDENT
map <silent> <F4> mmgg=G`m^
imap <silent> <F4> <Esc> mmgg=G`m^
nnoremap <leader><space> :noh<cr>
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ImageMagick configure 6.7.5-7, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.5-7 --disable-dependency-tracking --enable-shared --disable-static --with-modules --without-gslib --with-gs-font-dir=/usr/local/share/ghostscript/fonts --without-magick-plus-plus
## --------- ##
## Platform. ##
git config --global alias.rma '!sh -c "git diff -z --name-only --diff-filter=D | xargs -0 git rm"'
config.middleware.insert_before(::Rack::Lock, ::Refraction)
Refraction.configure do |req|
if req.path == "/+"
req.permanent! "https://plus.google.com/102443793781999255197"
end
end
@jarinudom
jarinudom / bitcoin.rb
Created June 9, 2011 09:33
Simple bitcoin plugin for campfire-bot
class Bitcoin < CampfireBot::Plugin
on_command 'bitcoin', :bitcoin
# on_message registered below...
def initialize()
@log = Logging.logger["CampfireBot::Plugin::Bitcoin"]
end
def bitcoin(msg)
url = "https://mtgox.com/code/data/ticker.php"
(in /data/DevOpsGame/releases/20110517014854)
** Invoke environment (first_time)
** Execute environment
** Invoke resque:work (first_time)
** Invoke resque:setup (first_time)
** Execute resque:setup
** Execute resque:work
rake aborted!
undefined method `get' for nil:NilClass
/data/DevOpsGame/shared/bundled_gems/ruby/1.9.1/gems/redis-namespace-1.0.2/lib/redis/namespace.rb:213:in `method_missing'
desc "remotely console"
task :console, :roles => :app do
input = ''
run "cd #{current_path} && ./script/console #{ENV['RAILS_ENV']}" do |channel, stream, data|
next if data.chomp == input.chomp || data.chomp == ''
print data
channel.send_data(input = $stdin.gets) if data =~ /^(>|\?)>/
end
end