Skip to content

Instantly share code, notes, and snippets.

View cbrunsdon's full-sized avatar

Clarke Brunsdon cbrunsdon

View GitHub Profile
@cbrunsdon
cbrunsdon / generic_notifier.rb
Created December 6, 2010 03:58
ruby generic_notifier
#!/usr/bin/ruby
#based off jhawthorn's python generic_nofity.py
require 'net/http'
def send_notify(ticker, title, body)
if Weechat.config_get_plugin('account_name') == ""
return Weechat::WEECHAT_RC_OK
end
@cbrunsdon
cbrunsdon / gist:5687067
Created May 31, 2013 18:47
My nested routes don't play nicely with my namespaces
class Foo::Bar < ActiveRecord::Base
end
class Foo::Bar::Lols < ActiveRecord::Base
end
Routes.draw do
namespace :foo do
resources :bars do
resources :lols
config.to_prepare do
# Load application's model / class decorators
['lib', 'app'].each do |dir|
Dir.glob(File.join(File.dirname(__FILE__), "../#{dir}/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
end
@cbrunsdon
cbrunsdon / gist:5810498
Created June 18, 2013 23:40
lols caller()
class Foo
def hello
puts "Original Method"
puts caller(1)
end
end
class HijackStuff
def hijack
Foo.class_eval do
=> {"org"=>
{"mpris"=>{"MediaPlayer2"=>{}},
"gnome"=>
{"Rhythmbox3"=>
{"menus"=>{"appmenu"=>{}},
"window"=>{"1"=>{}},
"PlayQueue"=>{},
"RhythmDB"=>{},
"PlaylistManager"=>{}}}}}
Paperclip.interpolates :s3_path_prefix do |attachment, style|
attachment.instance.s3_path_prefix
end
@cbrunsdon
cbrunsdon / gist:6431217
Created September 4, 2013 00:06
gnome-shell build issues
*** Checking out gnome-shell *** [1/1]
git remote set-url origin git://git.gnome.org/gnome-shell
git remote update origin
Fetching origin
git rebase origin/master
Current branch master is up to date.
git submodule init
git submodule update
*** Configuring gnome-shell *** [1/1]
./autogen.sh --prefix /opt/gnome --libdir '/opt/gnome/lib' --enable-compile-warnings=maximum --disable-glibtest
@cbrunsdon
cbrunsdon / authentication_helpers.rb
Created October 8, 2013 20:46
authentication_helpers for rob
module AuthenticationHelpers
def sign_in_as!(user)
visit '/store/login'
fill_in 'Email', :with => user.email
fill_in 'Password', :with => 'secret'
click_button 'Login'
end
end
@cbrunsdon
cbrunsdon / site_announcement.rb
Created October 8, 2013 22:15
polymorphic for banister
user = User.create!
announcement = Announcement.create!
user.user_news << UserNews.create! subject: announcement
@cbrunsdon
cbrunsdon / gist:7272584
Created November 1, 2013 21:56
frt weechat grove settings
/server add frt freerunningtech.irc.grove.io/6697 -ssl
/set irc.server.frt.password freerunningtech
/set irc.server.frt.ssl_verify no
/set irc.server.frt.username "clarke"
/set irc.server.frt.command "/msg NickServ identify ******":