Skip to content

Instantly share code, notes, and snippets.

View stravid's full-sized avatar

David Strauß stravid

View GitHub Profile
@mrdoob
mrdoob / gist:718743
Last active July 23, 2023 06:53
Simplest HTML5 drawing tool
<html>
<style>
body {
margin: 0;
padding 0;
}
</style>
<body>
<script>
@tvandervossen
tvandervossen / testing.txt
Created April 13, 2011 20:13
A small part from a code review report for an iOS app
Testing
Automated testing (even though still not widely used by Objective-C developers) would make
refactoring much easier, faster and safer. Good test coverage would also allow maintenance
to be done and new features to be added without first having to fully investigate the
function of all parts of the codebase and the way these parts fit together. This especially
applies when work is contracted out to developers other than those who originally created
the application.
The lack of a comprehensive automated test suite is a real disadvantage. Adding one is
@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'))
@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('-')
@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
@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?
@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"
@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

@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:

@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
*)