Skip to content

Instantly share code, notes, and snippets.

David Strauß stravid

Block or report user

Report or block stravid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrdoob
mrdoob / gist:718743
Last active Aug 11, 2018
Simplest HTML5 drawing tool
View gist:718743
<html>
<style>
body {
margin: 0;
padding 0;
}
</style>
<body>
<script>
@tvandervossen
tvandervossen / testing.txt
Created Apr 13, 2011
A small part from a code review report for an iOS app
View testing.txt
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 Aug 31, 2011
Sprockets with a simple Rack app
View config.ru
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 Nov 14, 2011
Backbone i18n with CoffeeScript
View i18n.coffee
# 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 Dec 6, 2011
.ircrb entry to run explain on a query.
View explain.rb
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 Dec 14, 2011
Initial client lead questions
View gist:1478543
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 Jan 3, 2012
Schema (SQL) and Data (JS) Migrations for node.js (specifically PostgreSQL, but could be MySQL)
View migrate.js
#!/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 Oct 6, 2019
Rails models cheatsheet
View index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to
has_one
@jimbojsb
jimbojsb / gist:1630790
Created Jan 18, 2012
Code highlighting for Keynote presentations
View gist:1630790

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 Feb 8, 2012
AppleScript to Open a New iTerm Window and bring it to the front
View New-iTerm-Window.scpt
(*
* 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
*)
You can’t perform that action at this time.