Skip to content

Instantly share code, notes, and snippets.

View shahzadns's full-sized avatar
:octocat:
Working on his projects.

Shahzad Nawaz shahzadns

:octocat:
Working on his projects.
View GitHub Profile
let lsb = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'saven', 'eight', 'nine'],
mid = ['', 'ten', 'tweenty', 'therty', 'fourty', 'fifty', 'sixty', 'saventy', 'eighty', 'ninty'],
msb = ['', 'one hundred', 'two hundred', 'three hundred', 'four hundred', 'five hundred', 'six hundred', 'saven hundred', 'eight hundred', 'nine hundred'],
num = 445;
input = String(num);
let msbBit = Number(input[0]),
midBit = input.length > 1 ? Number(input[1]) : 0,
lsbBit = input.length > 2 ? Number(input[2]) : 0;
//Array syntax
let promises = [promiseOne(), promiseTwo(), promiseThree()];
$q.all(promises).then((values) => {
console.log(values[0]); // value One
console.log(values[1]); // value Two
console.log(values[2]); // value Three
// do something
@shahzadns
shahzadns / AngularJS-BaseController.js
Last active February 16, 2019 18:23
This is an example for using a "Base Controller" in an AngularJS application, to get done some basic tasks like destroying $rootscope listeners, or any third-party component.
/**
* @title: `setting up BaseCtrl` in AngularJS 1.3.x
* @author: Shahzad Nawaz
* @dated: 2/28/2015.
*/
(function () {
'use strict';
/*Base Controller starts*/
@kirschbaum
kirschbaum / app.js
Last active December 4, 2020 16:18 — forked from victorb/app.js
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
scope: {
ngModel: '=',
details: '=?'
},
link: function(scope, element, attrs, model) {
@brock
brock / nodereinstall.sh
Last active April 17, 2024 08:26
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
@staltz
staltz / introrx.md
Last active April 20, 2024 14:15
The introduction to Reactive Programming you've been missing
@demisx
demisx / angularjs-providers-explained.md
Last active March 17, 2024 11:09
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@danburzo
danburzo / README.md
Last active July 29, 2021 08:41
Get all event listeners on the page in Google Chrome
@samwize
samwize / mocha-guide-to-testing.js
Created February 8, 2014 05:53
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName