Skip to content

Instantly share code, notes, and snippets.

View Kevnz's full-sized avatar
💭
Not writing the code

Kevin Isom Kevnz

💭
Not writing the code
View GitHub Profile
@Kevnz
Kevnz / yui3-dom.js
Created February 3, 2011 00:59
Using YUI3 within node.js fails for id selector, but not class selector
var result = fs.readFileSync(filename, "binary");
YUI({loadOptional: true})
.use('nodejs-dom', 'event', 'node', function(Y) {
var doc = Y.one('doc');
doc.empty();
doc.append(result);
var idSelector = 'div#test-id';
var classSelector = 'div.test-case';
var idContainer = Y.one(idSelector);
var classContainer = Y.one(classSelector);
@Kevnz
Kevnz / config.rb
Created March 30, 2011 20:59
Compass config
watch 'src/main/web/**/*' do | project_dir, relative_path |
dest_dir = File.join(project_dir, 'web')
src_path = File.join(project_dir, relative_path)
extn = File.extname(relative_path)
filename = File.basename(src_path, extn)
if extn == '.js'
parent_dir = File.join(dest_dir, parent_dir(src_path))
dest_path = File.join(parent_dir, filename + extn)
@Kevnz
Kevnz / gist:964117
Created May 10, 2011 08:41 — forked from ericf/gist:961730
A simple, small, and powerful CSS Grid System (based on YUI 3 CSS Grids)
/* Based on YUI 3 CSS Grids: http://developer.yahoo.com/yui/3/cssgrids/ */
.layout {
letter-spacing: -0.31em; /* webkit: collapse white-space between units */
*letter-spacing: normal; /* reset IE < 8 */
word-spacing: -0.43em; /* IE < 8 && gecko: collapse white-space between units */
}
.layout > *,
.layout .unit {
display: inline-block;
zoom: 1; *display: inline; /* IE < 8: fake inline-block */
@Kevnz
Kevnz / pgDebug.js
Created October 8, 2011 22:51 — forked from purplecabbage/pgDebug.js
Workout your iPhone PhoneGap UI in Desktop Safari
var safariDebug = ( navigator.platform.indexOf("iPhone") < 0 && navigator.platform.indexOf("iPod") < 0 && navigator.platform.indexOf("iPad") < 0 );
if(safariDebug)
{
PhoneGap.run_command = function()
{
if (!PhoneGap.available || !PhoneGap.queue.ready)
return;
@Kevnz
Kevnz / cocoa-hello-world2.js
Created January 25, 2012 20:57 — forked from indexzero/cocoa-hello-world2.js
Creating a Cocoa GUI window with NodObjC, with a proper Menu, dock icon, and NSApplicationDelegate.
// This example adapted from Matt Gallagher's "Minimalist Cocoa Programming"
// blog article:
// http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
var $ = require('NodObjC')
$.import('Cocoa')
var pool = $.NSAutoreleasePool('alloc')('init')
, app = $.NSApplication('sharedApplication')
@Kevnz
Kevnz / gist:2132072
Created March 20, 2012 06:42 — forked from SamSaffron/gist:2132065
Inject 300ms latency into network stack
#!/bin/sh
ipfw -q -f flush
ipfw add pipe 1 in
ipfw add pipe 2 out
ipfw pipe 1 config bw 512Kbit/s queue 30 delay 150ms
ipfw pipe 2 config bw 2Mbit/s queue 10 delay 150ms
ipfw -q add allow all from any to any
@Kevnz
Kevnz / gist:2141030
Created March 20, 2012 20:36 — forked from juandopazo/gist:1199502
jQuery, YUI-style
/*
* Assuming requireJS or another AMD loader
* The idea is to have each jQuery.require() call have its own copy of jQuery
* and all loaded modules copied into it, that way each call has its own "sandbox"
*/
(function (require, define) {
/*
* Optionally define a global config
* Configuration is basically tiered into three levels that overwrite each other in this order:
@Kevnz
Kevnz / gist:2760270
Created May 21, 2012 02:05
YUI Test: Good BDD version
/**
* Integration test
*/
(function () {
var YUITest = this.YUITest || require("yuitest");
YUITest.Node.CLI.XUnit();
@Kevnz
Kevnz / retina-sprites.css.scss
Created August 16, 2012 09:21 — forked from fourseven/retina-sprites.css.scss
A compass function to handle spriting with normal and retina images automatically.
// @Mixin Retina Sprite Sass
// ======================================================
// This requires two folders full of *.png files, normal and then
// 2x resolution. Please ensure that they have the same number and names
// of files.
// I've written this based off other efforts on the web, but none did
// both background-images and a set of sprites automatically.
// Still very much a work in progress.
// To use see the bottom three lines.
@Kevnz
Kevnz / app_net_grids.md
Created August 17, 2012 23:02 — forked from voidfiles/app_net_grids.md
How App.net uses YUI3 grids

How you can create a responsive grid system using YUI3 grids and SASS

This is a quick rundown of how and why we use YUI3 grids at App.net

As far as I can tell there are three types of CSS grids: a static-width pre-defined grid, a flexible-width pre-defined grid, and a generative grid. In the first two grids (pre-defined width), you basically decide how many columns you have across the screen, and then create blocks in any multiple of those. This pattern often looks like "span-4", "span-6", "pull-10", "push-5", etc. You find this style in popular frameworks like Bootstrap and Blueprint.

The third way, the generative/recursive grid system, doesn't seem to be as popular as the others. I am not entirely sure why, because the generative grid can pack more punch in less lines. In this vein is there is OOCSS and YUI3 CSS Grids.