Skip to content

Instantly share code, notes, and snippets.

View TechnotronicOz's full-sized avatar
🦖

Matt Carter TechnotronicOz

🦖
View GitHub Profile

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'];
//simple example of using lodash/underscore's template method
// update lodash/underscore to use mustache-style interpolations instead of erb
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g
};
// set the template
var template = _.template('<h1>{{title}}</h1><p>{{copy}}</p>');
var signedView = {
updateSig: function() {
newSig = this.signature();
if (newSig !== this._signature) {
this._signature = newSig;
return true;
}
return false;
}
}
setup_placeholders = (function() {
$.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) {
$.support.placeholder = true;
return function() {}
} else {
return function(){
getAlbums: function() {
var albums = [];
FB.api('/me/albums?fields=id,name', function(response) {
for ( var i = 0; i < response.data.length; i++ ) {
albums.push({ albumName: response.data[i] });
console.log(response.data[i]);
}
});
console.log('albums', albums);
FB.api(
'/me',
function(response) {
if ( response && !response.error ) {
return response;
} else {
return { error: response.error };
}
}
);
/**
* Our object namespacing
*/
window.EJ = window.EJ || {},
EJ.helpers = EJ.helpers || {},
EJ.helpers.device = EJ.helpers.device || {},
EJ.constants = EJ.constants || {},
EJ.features = EJ.features || {},
EJ.config = EJ.config || {};
/** @jsx React.DOM */
'use strict';
define(['react'], function(React) {
var NavItem = React.createClass({
render: function() {
return (
<li onClick={this.handleClick} data-page={this.props.page}>{this.props.itemName}</li>
);
},
handleClick: function(e) {
/**
* @jsx React.DOM
*/
App.Features.instagram = (function(ig){
var el = {};
var Instagram = React.createClass({
loadApi: function() {
$.ajax({
/**
* @jsx React.DOM
*/
App.Features.instagram = (function(ig){
var el = {};
var Instagram = React.createClass({
loadApi: function() {
$.ajax({