Setting up virtualenv and activating it
$ virtualenv venv --distribute
New python executable in venv/bin/python
Installing distribute.........done.
Installing pip................done.
$ source venv/bin/activate
(venv)$ python
'use strict'; | |
var chai = require('chai'), | |
expect = chai.expect, | |
sinon = require('sinon'), | |
sinonChai = require('sinon-chai'); | |
var Backbone = require('backbone'); | |
var _ = require('lodash/dist/lodash.underscore'); |
a = new Array(); | |
for (var b = 0; b < 10; b++) { | |
a[0] |= b; // <= ? | |
} |
Setting up virtualenv and activating it
$ virtualenv venv --distribute
New python executable in venv/bin/python
Installing distribute.........done.
Installing pip................done.
$ source venv/bin/activate
(venv)$ python
// the original Animal class and sayName method | |
function Animal(name, numLegs) { | |
this.name = name; | |
this.numLegs = numLegs; | |
} | |
Animal.prototype.sayName = function() { | |
console.log("Hi my name is " + this.name); | |
}; |
$ sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
$ sudo apt-get update | |
$ sudo apt-get install gdal-bin |
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
# tests done on an ubuntu vm | |
concat 1.65812611580 milliseconds | |
append 0.07023715973 milliseconds | |
list comprehension 0.03012800217 milliseconds | |
list range 0.00904202461 milliseconds |
/* | |
* program for tic-tac-toe game | |
* it starts with a randomly placed X | |
*/ | |
var ticTacToe = { | |
// board layout | |
board: [], | |
for (var i = 1; i <= 100; i++){ | |
if (i % 15 == 0) { | |
console.log('FizzBuzz') | |
} else if (i % 3 == 0) { | |
console.log('Fizz') | |
} else if (i % 5 == 0) { | |
console.log('Buzz') | |
} else { | |
console.log(i) | |
} |
var a = []; | |
a['0'] = 1; // assign value using property name as string | |
// number converted to string and used as property name | |
a[1] = 2; // assign value using property as an integer | |
a[2.0] = 3; // assign value using property as a floating point number | |
console.log(a) // => [1,2,3] | |
console.log(a.length) // => 3 |