Skip to content

Instantly share code, notes, and snippets.

View damncabbage's full-sized avatar
🙅‍♀️
permanent omnishambles

Robin Howard damncabbage

🙅‍♀️
permanent omnishambles
View GitHub Profile
@amouat
amouat / .conkyrc
Created January 6, 2012 20:11
Conky config for TODO system
#.conkyrc for TODOs
#
# Slightly modified version of basic config
#
# Adrian Mouat 2012
#
alignment top_right
background yes
border_width 1
default_color white
@dnagir
dnagir / async_smtp_delivery_method.rb
Created February 10, 2012 03:38
Threaded mail delivery in rails
# lib/async_smtp_delivery_method.rb
require 'mail'
class AsyncSmtpDeliveryMethod
def initialize(settings)
@settings = settings
end
def deliver!(mail)
@jonathanclarke
jonathanclarke / Avoiding precompile if no assets change when synching to S3
Created February 13, 2012 03:13
Avoiding precompile if no assets change when synching to S3
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
@passy
passy / chromium_daily.py
Created March 16, 2012 08:15
Chromium Daily Installer for Linux
#!/usr/bin/env python
# coding: utf-8
import errno
import os
import platform
import shutil
import stat
import subprocess
import sys
# This module intentionally minimizes dependencies to mitigate breakage risk.
# Subset of Syslog's numerical severity codes (RFC 3164, Table 2)
SEVERITY =
ERROR: 3
WARN: 4
INFO: 6
DEBUG: 7
# Configuration
@mipearson
mipearson / i_heart_asset_pipeline.md
Created April 16, 2012 02:11
I <3 the Asset Pipeline

I <3 the Asset Pipeline

People talk shit on Sprockets and the Asset Pipeline all the time. I get it. It's pretty confusing and when it breaks it can break in really undesirable ways. I was originally very sceptical, and I strongly considered upgrading to Rails 3.2 with sprockets disabled.

I didn't, and I'm glad I've stuck with the pipeline. Here's why:

  1. If you're using digested assets (by default you are), asset expiry just works. No cache clearing during dev, no "wait a few minutes for the CSS to expire", no expiring every asset on every deploy, no deployment issues where people get new HTML and old CSS or JS. Sprocket's digest strategy has so far been excellent and I'm glad it's there.

  2. SASS and CoffeeScript just work. No running guard or compass to watch and auto-compile your shit, relatively seamless integration into Rails, and effective separation of vendored code from application code.

@jfirebaugh
jfirebaugh / example_spec.js.coffee
Created April 25, 2012 18:19
Auto-restoring sinon fakes with Konacha
# require spec_helper
Test =
fn: -> 'result'
it 'auto-resets sinon fakes', ->
@stub(Test, 'fn')
Test.fn()
Test.fn.should.have.been.called
@unclebob
unclebob / apology.
Created April 27, 2012 12:19
Apology to Women Programmers.
Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed.
The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol.
I am a 59 year old programmer who was brought up
@fryguy1013
fryguy1013 / realtime.html
Created April 30, 2012 22:32
Realtime simplegraph
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js"></script>
<script type="text/javascript" src="http://jquery-websocket.googlecode.com/files/jquery.websocket-0.0.1.js"></script>

Routing in Ember

In Ember, the application's state manager handles routing. Let's take a look at a simple example:

App.stateManager = Ember.StateManager.create({
  start: Ember.State.extend({
    index: Ember.State.extend({
      route: "/",