Skip to content

Instantly share code, notes, and snippets.

@camerond
camerond / hrw_html5.markdown
Created October 18, 2010 13:11
HTML5 HRWay lunch

nav

header
	nav
		ul
			li
				a
			li.active
				a
@camerond
camerond / drivecosts_button_mixin.sass
Created September 21, 2011 01:11
DriveCosts button mixin
= button-skeleton($from, $to)
font-family: $proxima
font-weight: bold
line-height: 100%
text-transform: uppercase
text-decoration: none
cursor: pointer
+border-radius(5px)
color: #fff
+gradient-bg($from, $to)
@camerond
camerond / gist:1419548
Created December 1, 2011 20:21
SASS roman numbering
li
content: 'I.'
& + li
content: 'II.'
& + li
content: 'III.'
& + li
content: 'IV.'
& + li
content: 'V.'
@camerond
camerond / gist:2502862
Created April 26, 2012 20:33 — forked from shaneriley/gist:1854893
WTF CoffeeScript (refactor)
# Refactor of shane_riley's issue
$("dl.card :text").change ->
$e = $(@)
val = $e.val()
odd = []
even = []
for v, i in val.split("")
if !(i % 2) then odd.push(v)
else
@camerond
camerond / gist:2926259
Created June 13, 2012 20:18
Get the location of an @reply symbol in a string
# Implementation for a plugin that allows vaguely-Tweetbot-style @mention autofills.
# Finds the index of the @ symbol that should trigger a mention: the @ closest to the typing cursor
# that is preceded by a non-word character or the beginning of the string
#
# "@dave hey"
# ^
#
# "@john, I thought you should talk to @tony"
# ^
#
@camerond
camerond / mixins.sass
Last active October 11, 2015 10:37
Hashrocket Mixins file
// prefix support
$prefixes: webkit, moz, ms, o, khtml
= border-box
box-sizing: border-box
@each $prefix in $prefixes
-#{$prefix}-box-sizing: border-box
= border-top-radius($radius)
border-top-left-radius: $radius
border-top-right-radius: $radius
@camerond
camerond / button_mixins.sass
Created October 6, 2012 18:39
Example button mixins from a recent project
// example button mixins pasted in from a recent project.
// a hopefully useful example of how to inherit mixins from a base styleset
// and minimize verboseness of fancy gradients
= bg_sheen($bg)
background-color: $bg
background-image: -webkit-linear-gradient(top, rgba($bg, .5) 0%, rgba($bg + #111, .5) 49%, rgba($bg - #050505, .5) 50%, rgba($bg, .5) 100%)
background-image: -moz-linear-gradient(top, $bg 0%, $bg + #111 49%, $bg - #050505 50%, $bg 100%)
= button_base
@camerond
camerond / $.clickableTableRows
Created October 8, 2012 15:45
Make a <tr> with a single anchor inside of it clickable
$.fn.clickableTableRows = function() {
return this.each(function() {
var $table = $(this);
var bindEvents = true;
$table.find("tbody tr").each(function() {
var $tr = $(this);
if ($tr.find("a").length != 1 || $tr.find("input:visible").length) {
bindEvents = false;
return;
}
@camerond
camerond / ui_helper.rb
Last active December 11, 2015 17:58
My simple UI Helper in its more-or-less-current incarnation
module UiHelper
def lorem(paras)
paras = around(paras) if paras.is_a?(Range)
Faker::Lorem.paragraphs(paras).map{|p| "<p>#{p}</p>"}.join.html_safe
end
def lorem_words(num)
num = around(num) if num.is_a?(Range)
Faker::Lorem.words(num).join(' ').html_safe
@camerond
camerond / spectrum.sass
Created November 1, 2013 15:43
Color spectrum from grey through to pink (weather radar style), from .h0 to .h100
$colors: #a0a0a0, #4fb848, #d2be11, #e51b24, #f749fa
@for $i from 0 through 3
@for $j from 0 through 25
.h#{25*$i+$j}
background: mix(nth($colors, $i+2), nth($colors, $i+1), (($j/25) * 100))