What are we trying to observe? Raw object data.
// Objects
var obj = { id: 2 };
obj.id = 3; // obj == { id: 3 }
// Arrays
var arr = ['foo', 'bar'];
arr.splice(1, 1, 'baz'); // arr == ['foo', 'baz'];
| // sign up | |
| account.signUp('[email protected]', 'secret'); | |
| // sign in | |
| account.signIn('[email protected]', 'secret'); | |
| // sign in via oauth | |
| account.signInWith('twitter'); | |
| // sign out |
| // XORCipher - Super simple encryption using XOR and Base64 | |
| // | |
| // Depends on [Underscore](http://underscorejs.org/). | |
| // | |
| // As a warning, this is **not** a secure encryption algorythm. It uses a very | |
| // simplistic keystore and will be easy to crack. | |
| // | |
| // The Base64 algorythm is a modification of the one used in phpjs.org | |
| // * http://phpjs.org/functions/base64_encode/ | |
| // * http://phpjs.org/functions/base64_decode/ |
| // ------------------------------ | |
| // generic media query mixin | |
| // ------------------------------ | |
| // author: Anas Nakawa | |
| // license: MIT | |
| // ------------------------------ | |
| // table of content | |
| // ------------------------------ | |
| // media-compact-retina (private) | |
| // media-conpact-normal (private) |
| // tiny JavaScript inheritance | |
| // extracted from CoffeeScript | |
| // | |
| // * **param:** {Class} child | |
| // * **param:** {Class} parent | |
| var extends = function( child, parent ) { | |
| for ( var key in parent ) { | |
| if ( {}.hasOwnProperty.call( parent, key ) ) { | |
| child[ key ] = parent[ key ]; | |
| } |
| /* | |
| * source: http://nicolasgallagher.com/micro-clearfix-hack/ | |
| */ | |
| .clearfix:before, .clearfix:after { content: " "; display: table; } | |
| .clearfix:after { clear: both; } | |
| .clearfix { *zoom: 1; } |
What are we trying to observe? Raw object data.
// Objects
var obj = { id: 2 };
obj.id = 3; // obj == { id: 3 }
// Arrays
var arr = ['foo', 'bar'];
arr.splice(1, 1, 'baz'); // arr == ['foo', 'baz'];
| // AMD / Common Js / Browser Wrapper pattern | |
| // copyright to [millermedeiros](https://github.com/millermedeiros/js-signals/blob/master/src/wrapper.js) | |
| // --------------------------------- | |
| (function(global){ | |
| var libName; | |
| // define your library | |
| //exports to multiple environments | |
| if(typeof define === 'function' && define.amd){ //AMD |
| { | |
| "en": { | |
| "AD": "Andorra", | |
| "AE": "United Arab Emirates", | |
| "AF": "Afghanistan", | |
| "AG": "Antigua and Barbuda", | |
| "AI": "Anguilla", | |
| "AL": "Albania", | |
| "AM": "Armenia", | |
| "AN": "Netherlands Antilles", |
| module.exports = function(grunt) { | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('package.json'), | |
| concat: { | |
| options: { | |
| separator: ';' | |
| }, | |
| dist: { | |
| src: ['src/**/*.js'], | |
| dest: 'dist/<%= pkg.name %>.js' |
| // Tiniest Module Wrapper - (c) Anas Nakawa - <anas.nakawa {at} gmail.com> | |
| // License: MIT (http://www.opensource.org/licenses/mit-license.php) | |
| (function() { | |
| function myLibrary() {}; | |
| // CommonJs / Node | |
| ( typeof module !== "undefined" && module.exports && ( module.exports = myLibrary ) ) || | |
| // AMD / RequireJs | |
| ( typeof define !== "undefined" && !define(function() { return myLibrary; }) ) || | |
| // browser | |
| ( typeof window !== "undefined" && ( window.myLibrary = myLibrary ) ); |