Skip to content

Instantly share code, notes, and snippets.

@Rafe
Rafe / .babel.rc
Last active June 25, 2018 11:56
Facebook bot example
{
"presets": [
"es2015",
"stage-0"
]
}
pry(main)> show-doc Array#map
pry(main)> show-source Array#map
pry(main)> Pry.hooks.add_hook(:after_read, "uphook") do |text, pry|
pry(main)> puts text.upcase
pry(main)> end
pry(main)> cd <OBJECT_NAME>
pry(OBJECT_NAME)> self
@Rafe
Rafe / ttwig.sh
Created August 11, 2016 18:14
ttwig
ttwig() {
branches=$(twig | sed 1,3d | rev | cut -d ' ' -f 1 | rev)
select branch in $branches; do
git checkout $branch
break;
done
}
### find
find . -name "pattern"
-E regular expression
find / \! -user ccUser
### cut
cut
-d : delimiter
@Rafe
Rafe / gist:960a7703ef41bfc19753
Created December 6, 2015 18:06
curl cheat sheet
@Rafe
Rafe / mini-injector.js
Created April 16, 2015 02:44
Demonstrate how Angular.js injector works.
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
function annotate(fn) {
var $inject = [],
fnText,
argText,
last;
// Bootstrap Mid-Small - col-ms-* - the missing grid set for Bootstrap3.
//
// This is a hack to fill the gap between 480 and 767 pixels - a missing range
// in the bootstrap responsive grid structure. Use these classes to style pages
// on cellphones when they transition from portrait to landscape.
//
// Contains:
// Columns, Offsets, Pushes, Pulls for the Mid-Small layout
// Visibility classes for the Mid-Small layout
// Redefined visibility classes for the Extra Small layout

Real iOS Apps in AppStore, with source on GitHub:

thanks 4 putting source for a noob to learn a little

I've used these:

@Rafe
Rafe / cheet_spec.rb
Last active August 29, 2015 14:06
Reliable Capybara Cheetsheet
# Find the first matching element
# Bad:
first('.active').click
# Good:
find('.active').click
find('.active', match: :first).click
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'
require 'yaml'
require 'json'
require 'chef/run_list'
json_files = Dir::glob("./nodes/*.json")
Chef::Config[:cookbook_path] = './cookbook/'
Chef::Config[:role_path] = './roles/'