Skip to content

Instantly share code, notes, and snippets.

var values = {
// 1: Description
49: "Imagine you are creating a fence for a garden. Before you can make the fence, you need to make a model. Using Legos and Lego graph paper, make a model of the fence.",
// 2: Step One
50: "Your fence should be 20 units long and 10 units wide. Make your fence, take a picture of it and attach it to the card.",
// 3: Step 2
51: "Then, find the perimeter of the fence. If you do not remember how to find perimeter, click [here](http://www.brainpopjr.com/math/measurement/perimeter).",
@alexgb
alexgb / mock_versions.js
Created October 30, 2014 18:24
Test Vishnu Refresh
(function() {
var oldAjax = $.ajax;
$.ajax = function(url) {
if (url === '/version.json') {
return $.Deferred().resolve({"commit":"123","version":"v2"});
} else {
return oldAjax.apply($, arguments);
}
};
@alexgb
alexgb / rollbar debug.js
Created October 30, 2014 18:59
Rollbar debugging
(function() {
var oldRollbarError = Rollbar.error,
baseLogArgs = ['%c Rollbar ', 'background: #f55; color: white;'];
Rollbar.error = function() {
var args = Array.prototype.slice.call(arguments, 0);
console.log.apply(console, baseLogArgs.concat(args));
return oldRollbarError.apply(Rollbar, arguments);
};
var match = location.href.match(/trello\.com\/([[cb])\/(.*)\//),
boardId;
if (match[1] === 'c') {
boardId = window.IdCache.getBoardIdForCard(match[2]);
} else {
boardId = window.IdCache.getBoardId(match[2]);
}
$.ajax('/1/boards/' + boardId).then(function(board) {
var match = location.href.match(/trello\.com\/([[cb])\/(.*)\//),
copiedLabels = JSON.parse(localStorage.getItem('copiedLabels')),
cookies, token, boardId, data;
if (match[1] === 'c') {
boardId = window.IdCache.getBoardIdForCard(match[2]);
} else {
boardId = window.IdCache.getBoardId(match[2]);
}
var match = location.href.match(/trello\.com\/([[cb])\/(.*)\//),
cookies, token, boardId, data;
if (match[1] === 'c') {
boardId = window.IdCache.getBoardIdForCard(match[2]);
} else {
boardId = window.IdCache.getBoardId(match[2]);
}
// Exercise 2 - Closures
// Wrap the following code in a closure and export only the "countdown" function.
// Code
(function() {
var index;
function log(){
// Exercise 2 - Closures
// Wrap the following code in a closure and export only the "countdown" function.
// Code
(function(scope) {
var index;
function log(){
(function(scope) {
var index;
function log(){
console.log(index);
}
function iterate(){
log();
if(index>1) setTimeout(iterate, 1000);
// 1. Write a class to support the following code:
Person = function(name) {
this.name = name;
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
thomas.name // --> "Thomas"