Skip to content

Instantly share code, notes, and snippets.

View subtleGradient's full-sized avatar
👋

Tom Aylott subtleGradient

👋
View GitHub Profile
// Puncture a closure, absolute madness
Function.prototype.puncture = function(){
var wormhole = function(__cmd__){
return eval(__cmd__);
};
var source = ('' + this).match(/function.+?\{([\s\S]*)\}/)[1];
var fn = new Function('this.wormhole=' + wormhole + '\n' + source);
@subtleGradient
subtleGradient / Brilliance Black (Inverted).tmTheme
Created January 3, 2010 22:52
Brilliance Black, My Little Pony (Brilliance White), Brilliance Dull TextMate Themes in the `tmTheme` format. By Thomas Aylott (SubtleGradient). These themes were designed so that logically similar things will have similar colors. These are extremely rich
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Thomas Aylott</string>
<key>comment</key>
<string>Thomas Aylott ㊷ subtleGradient.com</string>
<key>name</key>
<string>Brilliance Black (Inverted)</string>
@subtleGradient
subtleGradient / global.jq.js
Created April 9, 2010 05:15
HTML5 Template with className states and browser detection
// Swap classes onload and domready
$(function(){ $('html').removeClass('not-ready').addClass('ready'); }); // jQuery
$(window).load(function(){ $('html').removeClass('loading').addClass('loaded'); });
// target a specific version
if (navigator.isIE == 6){
// do stuff for IE6
}
// Deliever different behaviour for a group of IE versions
Titanium.UI.setBackgroundColor('#000');
//Main Tab Group
var tabGroup = Titanium.UI.createTabGroup();
//Photo Selection Window
var photosWindow = Titanium.UI.createWindow({
url:'photos.js',
title:'Photos',
backgroundColor:'#fff'
Titanium.UI.setBackgroundColor('#000');
//Main Tab Group
var tabGroup = Titanium.UI.createTabGroup();
//Photo Selection Window
var photosWindow = Titanium.UI.createWindow({
url:'photos.js',
title:'Photos',
backgroundColor:'#fff'
(function()
{
var _fnMap = {};
$.fn.addClass = function(classes)
{
var vs = this;
if(!(classes > '') || vs.length == 0)
return this;
/**
* by Dmitry A. Soshnikov
*/
Object.defineProperty(Object, "essence", {
value: function objectEssence(value) {
var essence = {kind: Object.prototype.toString.call(value).slice(8, -1)};
// use Object(value) just for shortness, it's less effective
// than typeof value == "object" && value !== null || typeof value == "function"
essence[value === Object(value) ? "object" : "primitive"] = true;
var playhead, art, keyframe1, keyframe2;
addEvent('load', function(){
art = new ART(400, 400).inject(document.body);
playhead = new ART.Rectangle(200, 200)
.inject(art)
.fill('#00F');
//media as attribute
%script{:src => "/Theme/HUD/screen.css", :media => "screen and (lsd-theme: HUD)"}
//media to deliver combined stylesheet
button
+inline-block
@media (lsd-theme: HUD)
button
&:icon
/**
* This library defines a new style ES objects
* which support delegation based mixins. A mixin
* chain is stored in the internal [[Mixin]] property.
*
* Used features: Harmony (ES6) proxies.
*
* Tested in FF4 beta.
*
* @author Dmitry A. Soshnikov <dmitry.soshnikov@gmail.com>