Skip to content

Instantly share code, notes, and snippets.

tell application "System Events"
set frontProcess to first process whose frontmost is true
-- When it's down to just Finder and the front process, we have to switch
-- to the Finder first to get the front process to hide itself. Furthermore,
-- the Finder will not be listed as among the visible processes unless it
-- has open windows, so treat a condition of 2 *or fewer* visible apps as
-- meaning the Finder should be activated before hiding the front process.
@dvbportal
dvbportal / redis-counters.js
Created February 5, 2012 12:30
Storing Counters In Redis
// Additional code in node-http-proxy.js
var crypto = require('crypto');
var redis = require('redis');
var client = redis.createClient(config.opt.redis_port, 'cloudno.de');
client.auth(config.opt.redis_auth, function(result) {
util.log("Redis authenticated.");
})
@danielberlinger
danielberlinger / indirect_start_redis_server.sh
Created December 19, 2011 21:36
How homebrew starts redis server
launchctl load -w ~/Library/LaunchAgents/io.redis.redis-server.plist
@brentertz
brentertz / rvm2rbenv.txt
Created November 21, 2011 23:00
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@the-architect
the-architect / contact.rb
Created September 15, 2011 16:09
Automatically create scopes for all available state_machine states in Rails 3.1
class Contact < ActiveRecord::Base
state_machine :state, :initial => :imported do
state :imported
state :contacted
state :verified
state :prospect
state :deleted
end
# Pipe Ars Technica's live Apple event coverage into a Campfire room.
# http://arstechnica.com/apple/news/2010/01/tablet-live-event-liveblog.ars
#
# Usage:
# $ gem install -r hpricot tinder
# $ ruby -rubygems ars_live.rb -ssl mysubdomain myroomid myapikey
require "hpricot"
require "open-uri"
require "tinder"