Skip to content

Instantly share code, notes, and snippets.

global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
require 'rubygems'
require 'open-uri'
require 'mechanize'
require 'pp'
site_dashboard_url = 'http://www.tumblr.com/tumblelog/lstoll'
email = '[email protected]'
password = 'xxxxxx'
agent = WWW::Mechanize.new
desc "deploys to heroku"
task :heroku_deploy do
# create the git repo
`cd #{RAILS_ROOT} && mkdir .heroku_cache && cd .heroku_cache && git init`
# update files
`rsync -a --exclude=config/database.yml --exclude=.svn --exclude=.hg --exclude=.heroku_cache --delete #{RAILS_ROOT}/* #{RAILS_ROOT}/.heroku_cache/ `
# git addremove
`cd #{RAILS_ROOT}/.heroku_cache && git add -A && git ls-files --deleted -z | xargs -0 git rm`
# git commit
`cd #{RAILS_ROOT}/.heroku_cache && git commit -m 'deploy commit'`
# Disables spotlight icon in 10.6 - will need to re-run after updates
sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
killall SystemUIServer
$.getJSON('http://whereami.lds.li/loc.json?callback=?', function(data) {
var locstr = '';
if (data.city == 'N/A') {
locstr = 'Not Available..';
}
else {
locstr = data.city + ', ' + data.state + ', ' + data.country + '.';
locstr = '<a href="http://maps.google.com/maps?q='+ locstr + '&z=6">' + locstr + '</a>';
}
$('.currentloc').text(locstr);
#!/usr/bin/env ruby
require 'rubygems'
require 'vagrant'
Vagrant::Environment.load!
env = Vagrant::Environment.load!(Dir.pwd)
env.require_persisted_vm
sshconn = Vagrant::SSH.new(env)
sshconn.execute do |ssh|
cmd = "cd /tmp/vagrant-chef && sudo chef-solo -c solo.rb -j dna.json"
public static void receiveMessage() {
// Parse the message details
String to = params.get("to");
String from = params.get("from");
String body = params.get("body");
// LOG the request details
Logger.debug("XMPP Message sent to " + to + " by " + from + " is " + body );
ok();
}
package controllers;
import java.io.*;
import java.util.Map;
import play.Logger;
import play.mvc.*;
public class Application extends Controller {
public static void index() {
## Converts ObjectIds to Strings in a mongodb json dump. Can use this to convert for use in mongoid
require 'json'
def convert_id(item)
if id = item['_id']['$oid']
item['_id'] = id
end
end
gem 'compass', '0.10.2'
gem 'compass-960-plugin', :require => 'ninesixty'
gem 'haml', '3.0.10'