Skip to content

Instantly share code, notes, and snippets.

@smalljam
smalljam / gist:1321884
Created October 28, 2011 08:41
Frontend engineering training course
// LECTURES
Frontend engineering introduction (2 x 1 hour)
- web development is
- history
- current situation
- languages and platforms
- FE definition
- Job specific
- knowledge areas
// 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) ) {
@smalljam
smalljam / static_server.js
Created July 25, 2011 17:32 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
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);
// (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] ];
@smalljam
smalljam / multiModelExample.js
Created April 21, 2011 13:01
Backbone multimodel proof of concept
// 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){
/**
* Created by JetBrains PhpStorm.
* User: adyshev
* Date: 06.04.11
* Time: 12:58
*/
var globalVar = null;
var StrongCookies = jQuery.Class.create({