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
git log --graph --decorate --pretty=oneline --abbrev-commit --all |
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
# Usage: redis-cli publish message hello | |
require 'sinatra' | |
require 'redis' | |
conns = [] | |
get '/' do | |
erb :index | |
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 DragAndDropSimulator | |
def initialize(page, drag) | |
@page = page | |
@drag = drag | |
end | |
def up(num) | |
drag_and_drop(num) | |
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
def after_sign_in_path_for(resource) | |
if resource.is_a?(User) | |
redirect_after_login = session[:redirect_after_login] | |
if redirect_after_login | |
clear_redirect_after_login | |
return redirect_after_login | |
end | |
else | |
super | |
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
# ~/.bashrc | |
# add this line so keep .bashrc cleaner, if you don't already have it in there somewhere | |
[ ! -f "$HOME/.bashrc.local" ] || . "$HOME/.bashrc.local" |
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 Bundles here: | |
" | |
" themes | |
Bundle 'railscasts' | |
Bundle 'molokai' | |
Bundle 'tpope/vim-vividchalk' | |
Bundle 'nowk/vim-flog' | |
" 'fousa/vim-flog' fork | |
" Bundle 'mbadran/headlights' |
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
def is_js? | |
Capybara::Selenium::Driver == page.driver.class | |
end | |
page.execute_script('$("#selector").tinymce().setContent("Test goes here")') | |
# this does not work (or does not work anymore) | |
# it asks to switch the to the frame | |
within_frame("#{name}_ifr") do |
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
/ ko with: paginate | |
.will_paginate | |
%span.per_page_options | |
Show rows | |
%select.per_page{:name => "per_page", 'data-bind' => 'options: per_page_limits, value: per_page'} | |
| |
%span.go_to_page_options | |
Go to | |
%input{:name => 'page', :type => 'text', :size => "2", 'data-bind' => 'value: page, valueUpdate: "afterKeyDown"'} | |
|
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
def mapping_for_js(resource, options={}) | |
resource_name = resource.is_a?(ActiveRecord::Relation) ? | |
resource.name.tableize : resource.class.to_s.underscore | |
payload = { | |
resource_name => JSON.parse(resource.to_json(options[:to_json])) | |
} | |
# only merge if paginated |
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
// prepare the form when the DOM is ready | |
$(document).ready(function() { | |
// Setup the ajax indicator | |
$('body').append('<div id="ajaxBusy"><p><img src="images/loading.gif"></p></div>'); | |
$('#ajaxBusy').css({ | |
display:"none", | |
margin:"0px", | |
paddingLeft:"0px", |