Skip to content

Instantly share code, notes, and snippets.

View NoumanSaleem's full-sized avatar

Nouman Saleem NoumanSaleem

View GitHub Profile
@NoumanSaleem
NoumanSaleem / install.sh
Last active August 29, 2015 13:55
Mac setup bash script.Usage: Save file and open a terminal window in the same directory. Run: source install.sh (Change install.sh to w/e you saved the file as.)
# Install homebrew
echo 'Install Homebrew'
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
# Install node.js
echo 'Install node.js'
brew install node
# Npm without sudo
sudo chown -R `whoami` ~/.npm
@NoumanSaleem
NoumanSaleem / namedRoutes.js
Created September 17, 2014 15:40
named routes in angular (directive and filter)
'use strict';
(function (angular) {
function tokenToRegExp(token) {
return new RegExp(':(' + token + ')(?:\\(([^\\(]+)\\))?');
}
angular.module('fdNamedRoutes', [])
.provider('namedRouteProvider', ['$locationProvider', function namedRouteProvider($locationProvider) {
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@NoumanSaleem
NoumanSaleem / validator.js
Last active December 21, 2015 21:09
Extend Node Validator to support per-check title + return total number of errors.
/*
Usage:
Var Validator = require('path-To-Your/lib/validator'),
validator = new Validator();
validator.checkField('first_name', 'foo', {
isNumeric: 'This is not a number',
contains: 'The value doesn\'t have a 0 in it'
@NoumanSaleem
NoumanSaleem / gist:7436251
Created November 12, 2013 18:33
Increase sound quality for Bluetooth devices - OSX
# From: https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
{
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"requireSpacesInsideObjectBrackets": "allButNested",
"disallowSpaceAfterObjectKeys": true,
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
.squared { position: relative; display: block; overflow: hidden; padding-top: 100%; }
.squared > img { position: absolute; top: 0; }
.squared.background { background-size: 100%; background-size: cover; background-position: center; }
.squared.background > img { opacity: 0; }

Keybase proof

I hereby claim:

  • I am noumansaleem on github.
  • I am nouman (https://keybase.io/nouman) on keybase.
  • I have a public key whose fingerprint is D55A EA69 F408 B91F 4C5A 2208 4215 3043 A80D 37FD

To claim this, I am signing this object: