This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
#!/bin/bash | |
# Backup script for BASH relying on Az CLI | |
containerName=azureBlobStorageContainerName | |
storageAccountName=storageAccountName | |
subscription=subscriptionId | |
resourceGroup=resourceGroupName | |
file="${1,,}" | |
now=$(date +"%F.%T"); | |
backupFileName="BACKUP ON $now" |
function powerSet(s) { | |
if(s.length === 0){ | |
return [[]]; | |
} | |
var headOfList = s.splice(0,1)[0]; | |
var powerSetOfListTail = powerSet(s); | |
var powerSetOfListTailWithHead = powerSetOfListTail.map(function(p) { | |
var cpy = p.slice(); | |
cpy.push(headOfList); |
var squareNumbers = function (number) { | |
return number * number; | |
}; | |
var numbers = [1,2,3,4]; | |
var squares = $.map(numbers, squareNumbers); | |
//logs [1,4,9,16] | |
console.log(squares); |
[ | |
{name: 'Afghanistan', code: 'AF'}, | |
{name: 'Åland Islands', code: 'AX'}, | |
{name: 'Albania', code: 'AL'}, | |
{name: 'Algeria', code: 'DZ'}, | |
{name: 'American Samoa', code: 'AS'}, | |
{name: 'AndorrA', code: 'AD'}, | |
{name: 'Angola', code: 'AO'}, | |
{name: 'Anguilla', code: 'AI'}, | |
{name: 'Antarctica', code: 'AQ'}, |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
qunit: { | |
files: ['test/**/*.html'] | |
}, | |
jshint: { //Lint files, different tasks exist | |
tests: { //lint JS tests | |
files: { | |
src: ['test/**/*.js'] | |
}, |
//Constructor | |
var Person = function (name, age){ | |
//private properties | |
var priv = {}; | |
//Public properties | |
this.name = name; | |
this.age = age; | |
//Public methods |
var makePubSub = function () { | |
var callbacks = {}, | |
publish = function (){ | |
//Turn arguments object into real array | |
var args = Array.prototype.slice.call(arguments, 0); | |
//Extract the event name which is the first entry | |
var ev = args.shift(); | |
//Return if callbacks object doesn't contain |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer