Skip to content

Instantly share code, notes, and snippets.

View paul's full-sized avatar

Paul Sadauskas paul

View GitHub Profile

We deploy our application at multiple customer sites, and need to come up with a way to handle custom styles for each deployment. Using compass and scss, I've made it so that I only have to change two variables to brand the site. My first stab was something like this:

# in app/views/layouts/application.html.haml:
%body{:class => dashed_fqdn}

# in app/scripts/_branding.scss:

$base-color: red;

$logo-url: "/images/logo.png";

Mar 11 13:06:04 vagrant escalation_stepper:140172834748176:Miniproc_Process::run: Checking for incoming message
Mar 11 13:06:04 vagrant escalation_stepper:140172834748176:Miniproc_Process::run: Consumed message tag: escalation_stepper_dispatch_queue
Mar 11 13:06:04 vagrant escalation_stepper:140172834748176:Miniproc_Process::run: Consumed message rk: escalation_stepper
Mar 11 13:06:04 vagrant escalation_stepper:140172834748176:Miniproc_Process::run: Consumed message exchange: escalation_exchange
Mar 11 13:06:04 vagrant escalation_stepper:140172834748176:Miniproc_Process::run: Processing a data message
Mar 11 13:06:04 vagrant escalation_stepper:140172834748176:Miniproc_Process::run: DEBUG: Incoming Message Data: {"escalation":{"status":2,"state_change":true,"new_state":"ack","escalation_definition":{"id":"1264ff6d-9d32-4985-aa47-65cc233b5d0e","href":"http://alarm.vagrant.localhost/escalation_definitions/1"},"changed_by_user":{"id":"f36f3fff-4602-4ce2-b88a-7dae52f4b886","href":"http://core.vagrant.localho
OFFSETS = [
[-1,-1],
[-1, 0],
[-1, 1],
[ 0,-1],
[ 0, 1],
[ 1,-1],
[ 1, 0],
[ 1, 1]
namespace :schema do
desc "Update doc/schema.dot with database schema"
task :gv => :environment do
@tables = []
Rails.configuration.paths.app.models.paths.each do |path|
Dir[File.join(path, '*.rb')].each do |f|
klass = File.basename(f, '.*').camelize.constantize
@paul
paul / 1.hs
Created February 6, 2011 00:09
module Main where
sumOfMultiples :: [Integer] -> Integer
sumOfMultiples (n) = sum [x | x <- n, x `mod` 3 == 0 || x `mod` 5 == 0]
main = print $ sumOfMultiples [1..999]
$ sudo gem install mysql
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
$ bundle install
Fetching source index for http://rubygems.org/
...
Installing mysql (2.8.1) with native extensions /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/bin/ruby extconf.rb
WITH RECURSIVE descendants(id, active, name, longname, parent_id, reseller, created_at, updated_at, uuid) AS (
SELECT * FROM client WHERE {conditions...}
UNION
SELECT client.* FROM client, descendants WHERE client.parent_id = descendants.id
)
SELECT * FROM descendants
-- OR --
SELECT * FROM clients WHERE id IN (
template = "
<tr>
<td class='hostname'>{{name}}</td>
<td class='tags'>{{tags}}</td>
<td class='chart'><div class='sparkline'></div></td>
<td class='current'><meter/></td>
<td class='actions'><a href='#'><img src='images/detail.png'/></a></td>
</tr>
"
$template = Handlebars.compile(template)
class MyClass
one: (callback) ->
console.log "one"
callback "output"
two: () ->
@one (string) ->
console.log string
@one (string) -> # `one` is out of scope here
http = require 'http'
class SSBERequest
constructor: (@backend) ->
@client = http.createClient 80, @backend
@request_headers = {
'Accept': 'application/vnd.absperf.sskj1+json',
'Host': @backend
}