Skip to content

Instantly share code, notes, and snippets.

"app".foo(); // Fail. The method `foo` doesn't exist
require('commonjs_mod'); // Modifies the String native
"app".foo(); // no Fail. The method `foo` was added
var Moo = function(){
var context = this;
var Class = this.Class = function(){};
this.String.prototype.foo = function(){ return "foo'd"; };
context.String.prototype.bar = function(){ return "bar'd"; };
};
// Wrap all of MooTools code in a function
/*<b support="CommonJS Modules namespace">*/var MooTools = function(exports){/*</b>*/
// fallback exports to `this` so that it can be used as both:
// `MooTools.apply(context)`
// this is the only style that'll work in CommonJS since exports can't be a function
// `MooTools(context)`
// `MooTools()`
if (typeof exports == 'undefined') exports = this;
var context = exports;
@subtleGradient
subtleGradient / animation.js
Created April 29, 2010 18:12
Simple animation implementation uses CSS Animation where available uses MooTools' Fx for other browsers
/*
---
name : Animation
provides : Animation
description : |
Simple animation implementation
uses CSS Animation where available
uses MooTools' Fx for other browsers
authors : Valerio Proietti (http://mad4milk.net)
/*
---
name: fx
description: very basic animation logic.
authors:
- "[Valerio Proietti](http://mad4milk.net)"
- "[Thomas Aylott](http://subtlegradient.com)"
license: "[MIT](http://mootools.net/license.txt)"
provides: fx
...
<form>
<input type="datetime" data-behavior="TimePicker" data-timepicker-pad="true" data-timepicker-labels-hours="HR" />
</form>
<a href="#my_modal" data-behavior="TargetModal">Open Modal</a>
<div id="my_modal" data-behavior="Modal" data-modal-style="color:#333; opacity:0.7">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
@subtleGradient
subtleGradient / Object.getPrototypeOf.js
Created June 28, 2011 22:22 — forked from xavierm02/Object.getPrototypeOf.js
Polyfill for Object.getPrototypeOf
if (typeof Object.getPrototypeOf != "function")(function(){
Object.getPrototypeOf =
(typeof "".__proto__ == "object")
? function(object){
return getPrototypeValue(object, '__proto__');
}
: function(object){
return getPrototypeValue(object, 'constructor').prototype;
@subtleGradient
subtleGradient / appify
Created July 19, 2011 17:16 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
appify v3.0.0 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@subtleGradient
subtleGradient / instance config pattern.js
Created July 29, 2011 20:55 — forked from nktpro/gist:1114601
instance config pattern
Ext.define('Ext.SomeThing', {
config: {
foo: {
height: 123,
baz: {
something: 'zzz'
}
},
bar: {
var regexp = LSD.RegExp({
'fn_tail': '\\.',
'fn_arguments': '\\g<inside_round>',
'fn_name': '\\g<unicode>',
'fn': '\\g<fn_tail>?\\g<fn_name>\\(\\g<fn_arguments>\\)',
'block_arguments': '\\g<inside_curly>',
'block_body': '\\g<inside_curly>',
'block': '\\{\\g<block_arguments>?\\g<block_body>\\}',