Skip to content

Instantly share code, notes, and snippets.

@angelo
angelo / cards.coffee
Created April 2, 2014 23:03
This bit of coffee handles the card finder style changes on http://creditcardreviews.com/. I used data attributes to define the card type for each button. This code updates the button and illustration styles when a user chooses a type of card to search for. It also updates the hidden 'type' field to send this information when the form is submitted.
$('.find-cards form a.button').click ->
$this = $ this
$this.addClass('active').siblings().removeClass 'active'
$('.types').removeClass('personal business student').addClass($this.data('type'))
$('#type').val $this.data('slug')
false
@angelo
angelo / mixins.sass
Created April 2, 2014 23:00
These are some mixins used to create some of the complex layouts on http://creditcardreviews.com/. These styles are applied in different contexts across the site. This makes it possible to change things in one place and apply everywhere.
// ---------------------------------------------------------------------------
// Imports
@import compass/css3
// ----------------------------------------------------------------------
// Colors
$gray: #979c9e
$blue: #4f95bf
@angelo
angelo / linez
Created January 29, 2011 03:12
makes all text files use unix line endings
#!/bin/sh
find . -type f -print | xargs file | grep text | cut -f1 -d: | while read i
do
flip -u $i
done
@angelo
angelo / img_coverage.rb
Created January 20, 2011 00:00
This ruby script finds unused image assets in a website project.
#!/usr/bin/env ruby
require 'fileutils'
files = Dir['**/*.{htm,html,shtml,php,css,js}']
images = Dir['**/*.{jpg,png,gif,bmp}']
puts "#{images.size} images found & #{files.size} files found to search against"
content = ""
var System = require('sys');
var WebSocket = require('../lib/websocket').WebSocket;
var Connection = require('../lib/connection').Connection;
var Connections = {};
var
Client = Connection;
Client.prototype.onmessage = function(data) {
var data = JSON.parse(data);