Skip to content

Instantly share code, notes, and snippets.

View achievements.js
/* Notes:
* Methods that modify the progress of the achievement have a notify option.
This option tells whether or not the user should be notified about the
achievement by the native UI (some sort of popup in the corner and maybe
a sound)
* The plan for this API is to perform network IO asynchrnously in the
background while using data cached by the Pine library to make the
API feel synchronous. Essentially, the progress of each achievement
will be loaded when the game is loaded and will be used for any
get operations with this API. An async request is put out when an
arextar / gist:2324454
Created Apr 7, 2012
adding :visible and :hidden to zepto
View gist:2324454
var _is = $, _filter = $.fn.filter;
function visible(elem){
elem = $(elem);
return !!(elem.width() || elem.height()) && elem.css("display") !== "none";
$ = function(sel){
if(sel === ":visible"){
View toMobile.js
~function(){var a=function(b,c){var d=a.resolve(b,c||"/"),e=a.modules[d];if(!e)throw new Error("Failed to resolve module "+b+", tried "+d);var f=e._cached?e._cached:e();return f};a.paths=[],a.modules={},a.extensions=[".js",".coffee"],a._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},a.resolve=function(){return function(b,c){function h(b){if(a.modules[b])return b;for(var c=0;c<a.extensions.length;c++){var d=a.extensions[c];if(a.modules[b+d])return b+d}}function i(b){b=b.replace(/\/+$/,"");var c=b+"/package.json";if(a.modules[c]){var e=a.modules[c](),f=e.browserify;if(typeof f=="object"&&f.main){var g=h(d.resolve(b,f.main));if(g)return g}else if(typeof f=="string"){var g=h(d.resolve(b,f));if(g)return g}else if(e.main){var g=h(d.resolve(b,e.main));if(g)return g}}return h(b+"/index")}function j(a,b){var c=k(b);for(var d=0;d<c.length;d++){var e=c[d],f=h(e+"/"+a);if(f)return f;var g=i(e+"/"+a);if(g)return g}var f=h(a);if(f)return f}function k(a){var b;a==="/"?b=[""]:b=d.normalize(a).split("/");var c=[];for(var e=b.
arextar / node-storage.js
Created Jan 1, 2012
A nodejs module for persisting, querying, and manipulating data
View node-storage.js = function(stay){
stay = require("./node-stay").store(stay);
var type = function(a){
var t = typeof a;
return t === 'object' ? {}, -1).toLowerCase() : t;
get = stay.get, set = stay.set, del = stay.del, exists = stay.exists
, it = {object:1, array:1}
arextar / btoa.js
Created Nov 12, 2011
Encode into Base64
View btoa.js
function btoa(
a, //String to encode
b, //Array of Base64 characters
c,d,e,f,g,x //Placeholder
for(d=a.length, //Set d to the input's length
e="charCodeAt", //Shortcut for String.charCodeAt
f=-[,2,1][d%3], //Get how many equal signs need to be added to the end
x=0; //Initiate iteration variable
x<d; //Continue loop until x exceeds the length of the input
arextar / LICENSE.txt
Created Sep 27, 2011 — forked from 140bytes/LICENSE.txt
Summation function
View LICENSE.txt
Version 2, December 2004
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
View README.markdown

A quick scripts to support basic unit conversion in coffeescript and javascript. All you have to do is put one way conversion from one unit to another (for example: s to ms is 1000) and handles bridging units (like converting ms to m) and going backwards in units. It does not yet support more complex conversions but this can be added by allowing a function to be set as the conversion factor (passing it a number, and whether it's forwards or reverse)

arextar / is.js
Created Sep 6, 2011
small selector testing function (would like to get it down to 140 bytes)
View is.js
function is(a,b,c,d){
for(c=d.length;b=b&&~(' '+a.className+' ').indexOf(' '+d[--c]+' '););
return b;
arextar / html.js
Created Jul 26, 2011
Simple html fragment parser
View html.js
return function(str){
//If there is already a cached element, return its clone
if(cache[str]) return cache[str].cloneNode(true)
//frag and par are originally the same. par is the current parent and frag is the document fragment being returned
var frag,par=frag=document.createDocumentFragment();
arextar / deferred.js
Created Jul 18, 2011
Deferred Object
View deferred.js
function trigger(arr,con,args){
for(var x=0;x<arr.length;x++) arr[x].apply(con||null,args||[]);
function d(fn){
var w=[],
You can’t perform that action at this time.