Skip to content

Instantly share code, notes, and snippets.

View wilsonpage's full-sized avatar

Wilson Page wilsonpage

View GitHub Profile
@wilsonpage
wilsonpage / Makefile
Created December 8, 2011 17:22
My first Makefile
#========================================
# Static Asset Build Makefile
#
# Author: Wilson Page
#========================================
# Shortcuts
build-tools = build/tools/
css-dir = static/css/
@wilsonpage
wilsonpage / overlays.css
Created February 3, 2012 09:56
Testing
.overlay {
background: #333;
border: solid 1px;
border-color: #666 #222 #111 #555;
border-radius: 10px;
box-shadow:
0px 0px 18px rgbA(0,0,0,0.28),
1px 1px 6px rgbA(0,0,0,0.2),
inset 0px 3px 6px rgbA(255,255,255,0.1);
}
@wilsonpage
wilsonpage / overlays.css
Created February 3, 2012 09:57
This us my description
#overlay-container {
display: none; /* hidden by default */
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
-webkit-box-orient: horizontal;
@wilsonpage
wilsonpage / overlays.css
Created February 3, 2012 10:09
Gisttttttt
/******************************************
** CORE
******************************************/
#overlay-container {
display: none; /* hidden by default */
position: fixed;
left: 0px;
top: 0px;
@wilsonpage
wilsonpage / parseQueryString.js
Created February 10, 2012 16:28
Snippet to parse a query sting. Returns the string base and key/value object
/**
* Used to transform a query string of params and
* values into a useful javascript object.
*
* @param {String} str
* @return {Object}
*/
function parseQueryString(str) {
var
@wilsonpage
wilsonpage / module.js
Created March 3, 2012 17:55
How to define a module for both AMD and CommonJS compatibility
/**
* Registers module as CommonJS or AMD if support is found
* and creates an exports object for the module to use
*
* @param {boolean} cjs
* @param {boolean} amd
* @param {Object} ex
* @return {Object}
*/
var exports = (function(cjs, amd, ex){
@wilsonpage
wilsonpage / manual-populate.js
Created May 4, 2012 08:01
How to populate model ref property after instantiation?
var commentsSchema = new Schema({
content: { type: String },
_user: { type: Schema.ObjectId, ref: 'users' },
});
//...
// Get a comment without populating
.module-x {
background-color: red;
}
/**
* Exposed API
*/
@mixin module-x-blue {
background-color: blue;
@wilsonpage
wilsonpage / failing.js
Created January 17, 2013 14:05
The first fails to add the new file to the styles file list. The second one succeeds. I believe it to be related to the component.json being retrieved more than once.
var Builder = require('component-builder');
var path = require('path');
var fs = require('fs');
var async = require('async');
var builder = new Builder(__dirname + '/../client/item-view');
builder.use(compileSass);
builder.build(function(err, res){
@wilsonpage
wilsonpage / parents.js
Created April 4, 2013 17:50
Loops up the parent chain until a class match is found.
function parents(el, cl) {
while ((el = el.parentNode) && !~el.className.indexOf(cl));
return el;
}