This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script demonstrates the 4 rules for how the parameter 'this' works. | |
// 'this' is passed to each function at the moment it is invoked, and is a | |
// reference to the object that invokes the function. | |
// Let's define a function which returns the value of 'this' for its eventual | |
// context | |
var fn = function() { | |
return this; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var closure1; | |
var closure2; | |
var buildFullName = function(fname, lname) { | |
// building full name inside the execution context | |
var fullName = fname + ' ' + lname; | |
// defining a function to return fullname according to execution context | |
var printFullName = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This functions strips html tags from html string | |
function strip(html) { | |
var tmp = document.createElement("DIV"); | |
tmp.innerHTML = html; | |
return tmp.textContent || tmp.innerText || ""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# with AJAX withCredentials=false (cookies NOT sent) | |
Header always set Access-Control-Allow-Origin "*" | |
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE" | |
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type" | |
RewriteEngine On | |
RewriteCond %{REQUEST_METHOD} OPTIONS | |
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]] | |
# with AJAX withCredentials=true (cookies sent, SSL allowed...) | |
SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
-- This is a pom.xml file with basic configuration for | |
-- Defining a project (groupId, artifactId, version packaging) | |
-- Defining dependencies | |
-- Defining build plugins | |
-- How to build and execute | |
-- $ mvn install | |
-- $ mvn compile | |
-- $ mvn package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is an example config file for mongo-express (https://www.npmjs.com/package/mongo-express) | |
Should work without modifying if your mongodb server users are defaults | |
How to use: | |
1. Copy this file in your app/node_modules/mongo_express directory | |
2. Rename to config.js | |
*/ | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Node.js module to define an ExpressJS subrouter that handles requests | |
// to /auth path and uses passport to login using Instagram OAuth | |
var express = require('express'); | |
var session = require('express-session'); | |
var passport = require('passport'); | |
var instagramStrategy = require('passport-instagram').Strategy; | |
// Require user model | |
var User = require('./user'); |
NewerOlder