Skip to content

Instantly share code, notes, and snippets.

View nickcooley's full-sized avatar

Nick Cooley nickcooley

View GitHub Profile
@function color-shift($color, $amount: 10%) {
@return if(lightness($color) > 50%,
darken($color, $amount),
lighten($color, $amount))
}
$my-bg-color: #333;
$my-fg-color: #c00;
.shifted {
@nickcooley
nickcooley / _basics.scss
Created December 5, 2011 03:28
SASS Sample Files
body {
text-align: center;
> #container {
text-align:left;
margin:0 auto;
width:500px;
}
}
@nickcooley
nickcooley / gist:1207005
Created September 9, 2011 18:47
Excercise #5
//1.)
/*
document.getElementById('the_div').addEventListener(
'click', function(e){ log('the_div!') }, true);
document.getElementById('the_list').addEventListener(
'click', function(e){ log('the_list!') }, false);
document.getElementById('the_item').addEventListener(
'click', function(e){ log('the_item!') }, true);
@nickcooley
nickcooley / gist:1206772
Created September 9, 2011 17:11
Exercise 8
// 1. Write a class to support the following code:
var Person = function(name){
this.name = name;
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
// Exercise 1 - OO || !OO
// Define a data structure for cars (make and color), and a function
// that logs a string like "I'm a red Mercedes" to the console.
// Make two versions: a functional version, and a object-oriented version.
// Example call for functional version:
logCar({ color: 'blue', make: 'BMW' });
// Example call for OO version:
(new Car('Ferrari', 'red')).log();
// Exercise 2 - Closures
// Wrap the following code in a closure and export only the "countdown" function.
// Code
var executeCounts = (function(){
var index;
function log(){
// taken from http://www.dreamincode.net/code/snippet154.htm
//
// Find the weaknesses, and clean up the code.
// Find at least 3 things you can make better!
//
// Test numbers (return true):
// 4111111111111111
// 378282246310005
// 5555555555554444