This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use vars qw($VERSION %IRSSI); | |
| use Irssi; | |
| $VERSION = '0.0.1'; | |
| %IRSSI = ( | |
| authors => 'Tracey Eubanks', | |
| contact => 'someemail@gmail.com', | |
| name => 'growlme', | |
| description => "Send growl notifications when you receive a pm or you're mentioned in a channel", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // search through a two dimensional array | |
| Array.prototype.findIndexByCol = function(value,cIdx){ | |
| for (var i=0; i < this.length; i++) { | |
| // use === to check for Matches. ie., identical (===), ; | |
| if (this[i][cIdx] == value) { | |
| //alert(this[i][cIdx]+"===="+value); | |
| return i; | |
| } | |
| } | |
| return null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EM.schedule do | |
| user_subscription = Subscriptions::User.new | |
| Ragnar.exchange(:topic, 'events') do |x| | |
| x.queue_prefix = :service_name | |
| x.subscribe('user.delete', &user_subscription.method(:user_delete)) | |
| x.subscribe('user.login', &user_subscription.method(:user_login)) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'bunny' | |
| b_con = Bunny.new(host: 'localhost', port: 5672, logging: true) | |
| b_con.start | |
| b_q = b_con.queue('events') | |
| b_ex = b_con.exchange('events', type: :topic) | |
| b_ex.publish('message!!', key: 'usermanager.user.login') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Breakdown | |
| def gather_files(start_dir) | |
| files = [] | |
| Dir["#{start_dir}/*"].each do |file| | |
| if(File.directory?(file)) | |
| files += gather_files(file) | |
| else | |
| files << file | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeClass | |
| SOMECONSTANT = 'somevalue' | |
| ... | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeClass | |
| SOMECONSTANT = 'somevalue' | |
| ... | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Giles Bowkett, Greg Brown, and several audience members from Giles' Ruby East presentation. | |
| require 'tempfile' | |
| class InteractiveEditor | |
| DEBIAN_SENSIBLE_EDITOR = '/usr/bin/sensible-editor' | |
| MACOSX_OPEN_CMD = 'open' | |
| XDG_OPEN = '/usr/bin/xdg-open' | |
| def self.sensible_editor | |
| return ENV['VISUAL'] if ENV['VISUAL'] | |
| return ENV['EDITOR'] if ENV['EDITOR'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pg_dump <database_name> > database_name.pgdump | |
| cat database_name.pgdump | psql -d database_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my_hash.inject({}){|memo,(k,v)| memo[k.to_s] = v; memo} |