This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make sure underscore.js & backbone.js included above | |
$ = {ajax: function(){ | |
console.log('BAM!'); | |
console.dir(arguments); | |
}} | |
var BaseModel = Backbone.Model.extend({ | |
url: 'whatever', | |
save: function(attributes, options){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (obj, ['a', 'b', {'c':'b'}, 'e', 'f']) > {a:,b:,c:,e:,f:} | |
function mapper (obj, fields) { | |
var newObj = {}; | |
for(var i = 0, cnt = fields.length; i<cnt; i++) { | |
var f = fields[i]; | |
if(typeof f == 'string') { | |
newObj[f] = obj[f] | |
} else { | |
for(var k in f) { | |
newObj[k] = obj[ f[k] ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://jsfiddle.net/Exyk5/ | |
function decode(text){ | |
var lat='`~!@#$%^&qwertyuiop[]asdfghjkl;\'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"|ZXCVBNM<>?', | |
cyr='ёЁ!"№;%:?йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭ/ЯЧСМИТЬБЮ,', | |
from = cyr, | |
to = lat, | |
newtext = ''; | |
if( /[a-zA-Z]{2}/.test(text) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LECTURES | |
Frontend engineering introduction (2 x 1 hour) | |
- web development is | |
- history | |
- current situation | |
- languages and platforms | |
- FE definition | |
- Job specific | |
- knowledge areas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
body { | |
width: 200%; | |
height: 200%; | |
} | |
iframe { | |
-webkit-transform: scale(0.2); | |
-webkit-transform-origin: 0 0; | |
position: absolute; | |
width: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(ns){ | |
function createException(name) { | |
ns[name] = function(text) { | |
var r = Error.call(this, text); | |
r.name = name; | |
return r; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function assertInterface(keys, _interface) { | |
keys.forEach(function(key){ | |
assertFunction(_interface[key]); | |
}); | |
} | |
function assertStrictInterface(keys, _interface) { | |
assertEquals(keys, Object.keys(_interface)); | |
assertInterface(keys, _interface); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset=utf-8> | |
<script> | |
//https://raw.github.com/dankogai/js-base64/master/base64.js | |
(function(a){"use strict";var b;typeof module!="undefined"&&module.exports&&(b=require("buffer").Buffer);var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=function(a){for(var b={},c=0,d=a.length;d>c;c++)b[a.charAt(c)]=c;return b}(c),e=String.fromCharCode,f=function(a){var b=a.charCodeAt(0);return 128>b?a:2048>b?e(192|b>>>6)+e(128|b&63):e(224|b>>>12&15)+e(128|b>>>6&63)+e(128|b&63)},g=function(a){return a.replace(/[^\x00-\x7F]/g,f)},h=function(a){var b=[0,2,1][a.length%3],d=a.charCodeAt(0)<<16|(a.length>1?a.charCodeAt(1):0)<<8|(a.length>2?a.charCodeAt(2):0),e=[c.charAt(d>>>18),c.charAt(d>>>12&63),b>=2?"=":c.charAt(d>>>6&63),b>=1?"=":c.charAt(d&63)];return e.join("")},i=a.btoa||function(a){return a.replace(/[\s\S]{1,3}/g,h)},j=b?function(a){return new b(a).toString("base64")}:function(a){return i(g(a))},k=function(a,b){return b?j(a).replace(/[+\/]/g,function( |
OlderNewer