Skip to content

Instantly share code, notes, and snippets.

View Kevnz's full-sized avatar
💭
Writing the code again

Kevin Isom Kevnz

💭
Writing the code again
View GitHub Profile
YUI().use("singleton-class", function (Y) {
var instance1 = new Y.SingletonClass(),
instance2 = new Y.SingletonClass();
Y.log(instance1 === instance2); // true!
window.instance1 = instance1;
});
YUI().use("singleton-class", function (Y) {
/*global YUI*/
/**
* Prevents iOS from showing the URL bar for cancelled links
*
* @module ios-linkfix
* @requires base-build, event-touch, node-base, node-event-delegate, plugin
*/
YUI.add("ios-linkfix", function (Y, NAME) {
var HREF = "href",
DATA = "data-" + NAME,
YUI().use("singleton-class", function (Y) {
var instance1 = new Y.SingletonClass(),
instance2 = new Y.SingletonClass();
Y.log(instance1 === instance2); // true!
window.instance1 = instance1;
});
YUI().use("singleton-class", function (Y) {
@Kevnz
Kevnz / launch_sublime_from_terminal.markdown
Created September 29, 2012 19:49 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@Kevnz
Kevnz / javascript_background_thread.js
Created September 19, 2012 04:56 — forked from jameswomack/javascript_background_thread.js
Extend function prototype to run a function as a WebWorker
Function.prototype.runOnBackgroundThread = function (aCallback) {
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"});
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob));
_worker.onmessage = aCallback;
_worker.postMessage();
}
var _test = function () {
postMessage((1+1).toString());
}
@Kevnz
Kevnz / gist:3414161
Created August 21, 2012 10:11 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@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.

@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 / 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 / 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: