Skip to content

Instantly share code, notes, and snippets.

View jerodsanto's full-sized avatar
:shipit:
Always be shipping

Jerod Santo jerodsanto

:shipit:
Always be shipping
View GitHub Profile
@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('-')
- (void)loadDefaultSettings
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-Settings" ofType:@"plist"]];
// other setup...
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithDictionary:defaults]];
}
- (void)resetDefaultSettings
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# added rubygems, replaced script_path with script from path_parts, added to_return to fix return error - Paul Cook
# clearly this could be cleaner, but it does work
require 'rubygems'
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
@cpowell
cpowell / Datastore.rb
Created May 27, 2011 19:36
A singleton class to manage a MacRuby application's data storage requirements.
#
# Datastore.rb
# A singleton class to manage a MacRuby application's data storage requirements.
#
# Chris Powell, cpowell@prylis.com, http://cbpowell.wordpress.com
#
# This work is licensed under a Creative Commons Attribution 3.0 Unported License.
# http://creativecommons.org/licenses/by/3.0/
#
# For usage and discussion, see http://cbpowell.wordpress.com/category/macruby/
# cd into a matching gem directory. Pass a grep compatible
# regular expression. If you don't pass anything, it goes
# to the root gem directory.
cdgem ()
{
local gempath=$(gem env gemdir)/gems;
if [[ $1 == "" ]]; then
cd $gempath;
return;
fi;
@nathansmith
nathansmith / moz-webkit.css
Created March 22, 2011 01:51
Target Firefox and WebKit via hacky CSS.
/*
Read more here:
https://developer.mozilla.org/en/CSS/@-moz-document
For more browser-specific hacks:
http://paulirish.com/2009/browser-specific-css-hacks
*/
@-moz-document url-prefix() {
/* Put your Firefox specific code here. */
@bryanl
bryanl / campfire-emoji.txt
Created January 27, 2011 16:34
campfire emoji
Surround these with : e.g. :calling:
+1
-1
bulb
calling
clap
cop
email
feet
server {
listen 80;
server_name SERVER_NAME;
root PATH_TO_PUBLIC;
passenger_enabled on;
# serve static files directly
location ~ .html {
root PATH_TO_PUBLIC;
}
// Handles JavaScript history management and callbacks. To use, register a
// regexp that matches the history hash with its corresponding callback.
window.HashHistory = {
// The interval at which the window location is polled.
URL_CHECK_INTERVAL : 500,
// We need to use an iFrame to save history if we're in an old version of IE.
USE_IFRAME : jQuery.browser.msie && jQuery.browser.version < 8,
#!/usr/bin/env ruby
# Command line util for acquiring a one-off Twitter OAuth access token
# Based on http://blog.beefyapps.com/2010/01/simple-ruby-oauth-with-twitter/
require 'rubygems'
require 'oauth'
puts <<EOS
Set up your application at https://twitter.com/apps/ (as a 'Client' app),