Skip to content

Instantly share code, notes, and snippets.

View pvamshi's full-sized avatar

Vamshi Krishna pvamshi

View GitHub Profile
@pvamshi
pvamshi / hosting.js
Last active August 29, 2015 14:20
Javascript Hosting
function abc() {
console.log('Calling pr');
pr();
console.log('calling pr2');
pr2();
console.log('checking a ');
console.log(a);
var a;
console.log(a);
var d = 5;
@pvamshi
pvamshi / scope
Last active August 29, 2015 14:20
Scope
'use strict';
var globalObj = "Global";
/*
global variables are accessible to all functions
*/
function abc(){
console.log("Global object is "+globalObj);
}
abc();
@pvamshi
pvamshi / this.js
Last active August 29, 2015 14:20
Value of 'this'
console.log(this);
function printThis(){
console.log("Inside printThis");
console.log(this);
}
function printThisInClosure(){
console.log("Insude PrintThisInClosure");
console.log(this);
@pvamshi
pvamshi / truthy+falsy.js
Last active August 29, 2015 14:20
True or False
/*
Falsy values : "" , '' , 0 , undefined , null , NaN , false
*/
function evalTruth(a) {
if (a) {
console.log('TRUE');
} else {
console.log('FALSE');
}
}
@pvamshi
pvamshi / value_reference.js
Last active August 29, 2015 14:20
Pass by Value || Pass by Reference
function print(obj,str){
console.log("Object Name: "+obj.name);
console.log("String :"+str);
}
function changeValue(obj,str){
obj.name="something else";
str= "again something else";
str[0]='0';
}
'use strict';
angular.module('angularFlaskServices', ['ngResource'])
.factory('Post', function($resource) {
return $resource('/api/post/:postId', {}, {
query: {
method: 'GET',
params: { postId: '' },
isArray: true
}