Skip to content

Instantly share code, notes, and snippets.

/*
On OS X, basic text manipulations (left, right, command+left, etc) make use of the system key bindings,
and don't need to be repeated here. Anything listed here will take precedence, however.
*/
[
{ "keys": ["super+shift+n"], "command": "new_window" },
{ "keys": ["super+shift+w"], "command": "close_window" },
{ "keys": ["super+o"], "command": "prompt_open" },
{ "keys": ["super+shift+t"], "command": "reopen_last_file" },
{ "keys": ["super+alt+up"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} },
@joshsmith
joshsmith / burnthis.yml
Created March 15, 2013 14:39
tmuxinator yaml for burnthis
# ~/.tmuxinator/burnthis.yml
# you can make as many tabs as you wish...
project_name: burnthis
project_root: ~/sites/burnthis
tabs:
- main:
layout: tiled
panes:
- sleep 10; zeus console
@joshsmith
joshsmith / burnthis.yml
Created March 14, 2013 22:49
tmuxinator config
# ~/.tmuxinator/burnthis.yml
# you can make as many tabs as you wish...
project_name: burnthis
project_root: ~/sites/burnthis
tabs:
- services:
layout: main-vertical
panes:
- zeus start
module Kaleidoscope
module InstanceMethods
def colors_for
end
def generate_colors
Kaleidoscope.log("Generating colors.")
end
def destroy_colors
require 'rails'
require 'spec_helper'
require 'generator_spec/test_case'
require 'generators/kaleidoscope/kaleidoscope_generator'
describe 'TestMigration' do
include GeneratorSpec::TestCase
destination File.expand_path("../tmp", __FILE__)
arguments %w(photo)
alias gcb='git checkout -b' # Check out a new branch
alias hack='bash ~/hack.sh' # Hack on the branch
alias ship='bash ~/ship.sh' # Ship the feature
alias dwf='bash ~/dwf.sh' # Delete the working feature
alias hsd='hack && ship && dwf' # Hack, ship, delete
class Whatever < ActiveRecord::Base
before_validation :smart_add_url_protocol
validates_format_of :url,
:with => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix,
:message => "URL should be in this format: http://google.com"
private
def smart_add_url_protocol
- tutorial = @tutorial || Tutorial.new
= simple_form_for tutorial do |f|
= f.input :title, input_html: { class: 'span4' }
= f.input :url, label: 'URL', input_html: { class: 'span4' }
= f.input :description, as: :text, input_html: { class: 'span4' }
= f.submit "Add New Tutorial", class: 'btn btn-success'
@joshsmith
joshsmith / _.md
Created December 12, 2012 18:14
Another Inlet
def show
params[:page] ||= 1
@user = User.find_by_username!(params[:id].downcase)
@artworks = @user.artworks.paginate(:page => params[:page], :per_page => 10).recent
users_likes_ids = []
if signed_in?
artwork_ids = []