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 HackTheWorld | |
include Sidekiq::Worker | |
include Sidekiq::AnyQueue | |
def perform(arg1, arg2) | |
// ... | |
end | |
end | |
HackTheWorld.perform_async_on_queue(:fast, "arg1", "arg2") |
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
{ | |
"caret_extra_width": 1, | |
"caret_style": "phase", | |
"color_scheme": "Packages/Color Scheme - Default/SpaceCadet.tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"fade_fold_buttons": false, | |
"font_size": 15, | |
"highlight_line": true, | |
"ignored_packages": | |
[ |
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
// load Ruby on Rails unobtrusive scripting adapter for jQuery | |
// handles AJAX forms and client-side validation | |
//= require jquery_ujs |
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
# From Rails console, run the following and you'll see raw Moped queries for every Mongoid query! | |
Moped.logger = Logger.new(STDOUT) |
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
food = ["bacon", "eggs", "cheese", "eggs", "bacon", "bacon", "bacon"] | |
food.inject(Hash.new(0)) {|h, k| h[k] += 1; h }.sort_by {|k,v| -1 * v} | |
# => [["bacon", 4], ["eggs", 2], ["cheese", 1]] |
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 hasValues(hash, fields) { | |
return fields.map(field => { | |
return hash[field] != null; | |
}).reduce((x, y) => { return x || y }); | |
} | |
hash = { name: "robert paulson", affiliation: "fightclub" }; | |
hasValues(hash, [ "name", "email" ]); // => true | |
hasValues(hash, [ "email" ]); // => false |
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
load "#{Rails.root}/lib/my_file.rb" |
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
" Rob Volk's .vimrc, completely based off of " This is Rob Volk's .vimrc, completely based off of Gary Bernhardt's .vimrc file | |
" vim:set ts=2 sts=2 sw=2 expandtab: | |
autocmd! | |
call pathogen#infect('bundle/{}') | |
call plug#begin('~/.vim/plugged') | |
Plug 'prettier/vim-prettier', { | |
\ 'do': 'yarn install', |
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
// ES6 Fetch docs | |
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch | |
fetch('https://some.url.com') | |
.then(response => { | |
if (response.ok) { | |
return Promise.resolve(response); | |
} | |
else { | |
return Promise.reject(new Error('Failed to load')); |
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 scrabble { | |
node -p -e "const s = '$1'; let o = ''; for (c of s) o += ':scrabble-' + c + ': '" | |
} |
OlderNewer