This file contains 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
(function($) { | |
$.widget("ui.singleselect", { | |
options: { | |
// sortable: true, | |
// searchable: true, | |
animated: 'fast', | |
show: 'slideDown', | |
hide: 'slideUp' | |
}, |
This file contains 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
javascript:(function(){var%20d=document;var%20s=d.createElement('script');s.text="KOBJ_config={'a877x1:kynetx_app_version':'dev','rids':['a877x1']};";d.body.appendChild(s);var%20l=d.createElement('script');l.src='http://init.kobj.net/js/shared/kobj-static.js';d.body.appendChild(l);})() |
This file contains 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 Array | |
def natural_sort | |
just_letters = self.select{|el| el =~ /^[a-zA-Z]+$/} | |
numbers = self - just_letters | |
just_letters.sort + numbers.sort{|x,y| x.gsub(/[a-zA-Z]+/, '').to_i <=> y.gsub(/[a-zA-Z]+/, '').to_i} | |
end | |
end |
This file contains 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} |
This file contains 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 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 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 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 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 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') |
OlderNewer