Skip to content

Instantly share code, notes, and snippets.

View hafeez-syed's full-sized avatar
:octocat:
dont stop learning

Hafeez Syed hafeez-syed

:octocat:
dont stop learning
  • Melbourne, Australia
View GitHub Profile
angular.module('restangularDemoApp', [
'restangular',
'ngCookies'
])
.constant('apiKey', 'YOUR_Mongolab_API_KEY')
.config(function(RestangularProvider, apiKey) {
RestangularProvider.setBaseUrl('https://api.mongolab.com/api/1/databases/YOURDATABASE/collections');
RestangularProvider.setDefaultRequestParams({
apiKey: apiKey
})

Objects

To create a new object, use the new keyword followed by a call to a constructor function. Javascript provides the Object() constructor out-of-the-box:

var toilet = new Object();

Properties

Once you have an object, you can set and get properties on it, like this:

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

The gist

@hafeez-syed
hafeez-syed / Gruntfile.js
Created September 17, 2015 00:22
cleanup
var config = require('./config.json')
, files = {
html: "templates/*.html",
js: ["*.js", "js/**/*.js"],
json: ".json",
css: "css/**/*.css"
}
module.exports = function(grunt) {
grunt.initConfig({
@hafeez-syed
hafeez-syed / json_key_replacement.js
Created September 17, 2015 02:41
How to replace json `key` recursively in javascript
// change key as per requirement - I have used ":" in example JSON object below
var replace_key = ":"
, add_key = ""
, rwp = function rewriteProperties(obj) {
if (typeof obj !== "object") return obj
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
obj[prop.replace(replace_key, add_key)] = rewriteProperties(obj[prop])
if (prop.indexOf(replace_key) > -1) {
delete obj[prop]
@hafeez-syed
hafeez-syed / Ubuntu-for-developers.txt
Last active October 17, 2015 01:22
Freash ubuntu installation for developers
Essentials for fresh Ubuntu installation
*******************************************
vim
java
python
nodejs
git
ruby & ROR
apache
@hafeez-syed
hafeez-syed / Native functions
Last active January 19, 2017 04:50
Function call, apply and bind
***************************************************************
*************************** CALL ******************************
***************************************************************
<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// We use `call` to stabilize the value of `this` (as this can be a window object or a caller object)
function hafeez(param1, param2) {
console.log(this);
"dependencies": {
"angular": "^1.4.8",
"angular-animate": "~1.4.x",
"angular-cache": "git+https://git@github.com/jmdobry/angular-cache#2.3.7",
"angular-cookies": "~1.4.x",
"angular-load": "~0.2.0",
"angular-messages": "~1.4.x",
"angular-mocks": "~1.4.x",
"angular-resource": "~1.4.x",
"angular-route": "~1.4.x",
@hafeez-syed
hafeez-syed / npm-essentials
Last active June 3, 2016 01:24
Essential node modules for your javascript projects
apidoc
browsersync
del
grunt
gulp
autoprefixer
concat
connect
consolidate
file
@hafeez-syed
hafeez-syed / frontendDevlopmentBookmarks.md
Created January 22, 2016 02:54 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.