Skip to content

Instantly share code, notes, and snippets.

View abdulapopoola's full-sized avatar

AbdulFattaah Popoola abdulapopoola

View GitHub Profile
#!/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"
@abdulapopoola
abdulapopoola / PowerSet
Created January 27, 2015 05:37
PowerSet of a set in 16 lines of JavaScript
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);
@abdulapopoola
abdulapopoola / gist:7547693
Last active December 28, 2015 19:08
jQuery Map Example
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'},
@abdulapopoola
abdulapopoola / gist:5655160
Last active December 17, 2015 18:39
Sample GruntJS config file
module.exports = function(grunt) {
grunt.initConfig({
qunit: {
files: ['test/**/*.html']
},
jshint: { //Lint files, different tasks exist
tests: { //lint JS tests
files: {
src: ['test/**/*.js']
},
@abdulapopoola
abdulapopoola / gist:5251693
Last active March 27, 2017 02:58
Public, Private and Static Methods; JavaScript Style
//Constructor
var Person = function (name, age){
//private properties
var priv = {};
//Public properties
this.name = name;
this.age = age;
//Public methods
@abdulapopoola
abdulapopoola / gist:5127673
Last active November 7, 2016 06:16
PubSub implementation using closures in JavaScript
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
@abdulapopoola
abdulapopoola / about.md
Created September 19, 2011 09:43 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer