Skip to content

Instantly share code, notes, and snippets.

View stravid's full-sized avatar

David Strauß stravid

View GitHub Profile
@mbleigh
mbleigh / Gemfile
Created March 21, 2012 03:14
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
@jeffreyiacono
jeffreyiacono / Rakefile
Created February 8, 2012 20:15
rake task for precompiling assets using sprockets within a sinatra app + view helpers
require 'rubygems'
require 'bundler'
Bundler.require
require './application'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] do
end
@reyjrar
reyjrar / New-iTerm-Window.scpt
Created February 8, 2012 13:14
AppleScript to Open a New iTerm Window and bring it to the front
(*
* New-iTerm-Window.scpt
*
* Intended for use with QuickSilver
* I mapped option-y to running this script to create
* a new iTerm window on the current workspace
*
* Based on much Googling - very little "original" code here
* Comments/Suggestions to brad.lhotsky@gmail.com
*)
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@voodootikigod
voodootikigod / migrate.js
Created January 3, 2012 22:45
Schema (SQL) and Data (JS) Migrations for node.js (specifically PostgreSQL, but could be MySQL)
#!/usr/bin/env node
// this file is stored in a directory of APP_ROOT/script for me, all things are relative to that
var APP_ROOT = __dirname+"/../";
// this assumes there is a file stored in APP_ROOT called "config.js" with the following structure:
//
// module.exports = {
// "development: {
// "postgresql": "tcp://postgres@localhost/dev-db"
@tvandervossen
tvandervossen / gist:1478543
Created December 14, 2011 21:09
Initial client lead questions
Can you please answer the following questions so we can assess the project,
and judge if we would be a good match?
1. Is this a new project, or is this for an existing website or application?
- This is a project for a completely new site or application
- This is a project to update an existing site or application
2. Which of the following areas do you need help with?
@sirupsen
sirupsen / explain.rb
Created December 6, 2011 06:35
.ircrb entry to run explain on a query.
if defined? ActiveRecord
def explain(query)
query = query.to_sql if query.is_a?(ActiveRecord::Relation)
ActiveRecord::Base.connection
.execute("EXPLAIN ANALYZE #{query}")
.to_a
.each { |hash| puts hash["QUERY PLAN"] }
nil
@madrobby
madrobby / i18n.coffee
Created November 14, 2011 15:45
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
#
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
#
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
@markbates
markbates / config.ru
Created August 31, 2011 19:01
Sprockets with a simple Rack app
require 'sprockets'
project_root = File.expand_path(File.dirname(__FILE__))
assets = Sprockets::Environment.new(project_root) do |env|
env.logger = Logger.new(STDOUT)
end
assets.append_path(File.join(project_root, 'app', 'assets'))
assets.append_path(File.join(project_root, 'app', 'assets', 'javascripts'))
assets.append_path(File.join(project_root, 'app', 'assets', 'stylesheets'))