Skip to content

Instantly share code, notes, and snippets.

@sr3d
sr3d / cors-nginx.conf
Created May 24, 2012 13:52 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@sr3d
sr3d / gist:2038610
Created March 14, 2012 18:46
autobuild.rb
# This file is to rebuild the dist env automatically so that you don't have to
# rerun ant deploy all the time
#
# To run, install watchr gem
#
# gem install watchr
#
# Then simply run
#
# watchr autobuild.rb
@sr3d
sr3d / gist:1754122
Created February 6, 2012 19:07 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1754122)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
#
# Update to work with the falcon patch.
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
@sr3d
sr3d / gist:1562560
Created January 4, 2012 22:33
exchange_authentication.rb
Viewpoint::EWS::EWS.endpoint = 'https://webmail.sherweb2010.com/EWS/Exchange.asmx'
class << self
# Authenticate against @Wordnik.com Email account
# Viewpoint::EWS::EWS.set_auth('DOMAIN\alex_wordnik.com','password')
def authenticate(user, password)
user = user.downcase.strip
exchange_user = "DOMAIN\\#{user}_wordnik.com"
Rails.logger.debug "Authenticate for Exchange User #{exchange_user}"
Viewpoint::EWS::EWS.set_auth exchange_user, password
@sr3d
sr3d / gist:1434897
Created December 5, 2011 19:27
UberLogger
(function() {
if(typeof(console) == 'undefined') {
(function() {
/* Shim for window.console */
var methods = ['log', 'info', 'warn', 'error'];
window.console = {};
for(var i = 0; i < methods.length; i++){
window.console[ methods[i] ] = function() {};
}
})();
desc "Removes trailing whitespace and replaces tabs with two spaces"
task :whitespace do
sh %[find . \\( -name '*.rb' -or -name '*.yml' \\) -type f -exec ruby -pi -e 'gsub(/ +$/, "");gsub(/\t/, " ")' {} \\;]
end
var cachedFiles = {};
/* load a file and cache it so next time we don't have to re-evaluate again */
function load(path) {
if(!cachedFiles[path] || DEBUG ){
log('caching ' + path );
cachedFiles[path] = require(path);
};
return cachedFiles[path];
};
@sr3d
sr3d / celltrust.rb
Created March 29, 2011 01:57
Celltrust API Wrapper
module Celltrust
class Sms < Struct.new( :number, :message, :sms_id, :status )
@@count = 0
URL = 'https://www.primemessage.net/TxTNotify/SecureSMS'
def self.count
@@count
end
var TinyORM = (function(options) {
/* a hash containing all the available models */
var Models = {};
var connection = null;
var config = _.extend({
/* The name of the database which Ti will open. The local db is located at:
~/Library/Application Support/iPhone Simulator/4.2/Applications/APP_ID/Library/Application Support/database/dbname
*/
dbname: 'add.db',
@sr3d
sr3d / utils.js
Created February 23, 2011 10:17
my secret toolbelt
function log(object) {
Ti.API.debug(object);
if(logger) {
logger.log(object);
};
};
var indWin = null;
var actInd = null;