Skip to content

Instantly share code, notes, and snippets.

View pelted's full-sized avatar

Chris Born pelted

  • Seattle, WA
  • 11:21 (UTC -07:00)
View GitHub Profile
@pelted
pelted / api_and_client
Created January 3, 2012 17:53
Sinatra request with RestClient to API in same rack app
#config.ru
...
map "/api" do
run MyApi
end
map "/" do
run MyApp
end
@pelted
pelted / application_helper.rb
Created January 23, 2012 05:24 — forked from thatfunkymunki/application_helper.rb
Make will_paginate generate HTML that bootstrap.less will render nicely, fixed for will_paginate 3.0.2
# Based on https://gist.github.com/1205828, in turn based on https://gist.github.com/1182136
# Modified to work with Sinatra. WillPaginate uses LinkRender when used in Sinatra
class BootstrapLinkRenderer < LinkRenderer
protected
def html_container(html)
tag :div, tag(:ul, html), container_attributes
end
@pelted
pelted / min.rb
Created February 19, 2012 08:06 — forked from dnagir/min.rb
Spine minimization sizes
require 'closure-compiler'
packages = {
bare: %w{spine.js},
core: %w{spine.js ajax.js route.js tmpl.js},
full: %w{ajax.js list.js local.js manager.js relation.js route.js spine.js tabs.js tmpl.js}
}
packages.each_pair do |package, files|
all = files.inject('') {|m, c| m + File.read("lib/#{c}") }
@pelted
pelted / patch.rb
Created August 6, 2012 22:33 — forked from DAddYE/patch.rb
Postmark w/Padrino
# Add me in lib or somewhere
# lib/postmark_patch.rb
Mail::Message.class_eval do
def html?
content_type_without_symbol && content_type_without_symbol.include?('text/html')
end
end
@pelted
pelted / deploy.rb
Created November 21, 2013 00:04 — forked from pezholio/deploy.rb
set :domain, "licensing.lichfield-001.vm.brightbox.net"
set :application, "licensing"
set :deploy_to, "/home/rails/#{application}"
set :user, "rails"
set :use_sudo, false
ssh_options[:forward_agent] = true
set :scm, :git
@pelted
pelted / 0_reuse_code.js
Created November 21, 2013 06:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pelted
pelted / deploy.rb
Created November 21, 2013 19:54 — forked from mm53bar/deploy.rb
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git
doctype html
/[if lt IE 7]
html.no-js.ie6.oldie lang="en"
/[if IE 7]
html.no-js.ie7.oldie lang="en"
/[if IE 8]
html.no-js.ie8.oldie lang="en"
/[if gte IE 8]
html.no-js lang="en"
head
@pelted
pelted / rspec_model_testing_template.rb
Created November 3, 2015 22:23 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@pelted
pelted / gist:8974c4164eec7b3dd913
Created March 2, 2016 17:50 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat