This file contains hidden or 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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Web; | |
| namespace Sample | |
| { | |
| public class CrossOriginSupportModule : IHttpModule | |
| { |
This file contains hidden or 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 mongoose = require('mongoose'); | |
| var repository = function (modelName) { | |
| var self = this; | |
| self.Model = require('../models/' + modelName); | |
| self.FindById = function (id, cb) { | |
| self.FindOne({ |
This file contains hidden or 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
| '========================================================================== | |
| ' JSON Encoder for VBScript | |
| ' Copyright (c) 2013 Atif Aziz. All rights reserved. | |
| ' | |
| ' Licensed under the Apache License, Version 2.0 (the "License"); | |
| ' you may not use this file except in compliance with the License. | |
| ' You may obtain a copy of the License at | |
| ' | |
| ' http://www.apache.org/licenses/LICENSE-2.0 | |
| ' |
This file contains hidden or 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
| /** | |
| * AuthController | |
| * | |
| * @module :: Controller | |
| * @description :: A set of functions called `actions`. | |
| * | |
| * Actions contain code telling Sails how to respond to a certain type of request. | |
| * (i.e. do stuff, then send some JSON, show an HTML page, or redirect to another URL) | |
| * | |
| * You can configure the blueprint URLs which trigger these actions (`config/controllers.js`) |
This file contains hidden or 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
| /** | |
| * beforeBlueprint | |
| * | |
| * @module :: Policy | |
| * @description :: Simple policy to enable hooks into the model which can act upon req, res objects. | |
| * @docs :: http://sailsjs.org/#!documentation/policies | |
| * | |
| */ | |
| var actionUtil = require( 'sails/lib/hooks/blueprints/actionUtil' ); |
This file contains hidden or 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
| { | |
| // ----- NodeJS with Express ---------------------------------------------- | |
| "NodeJS Express Empty Module": { | |
| "prefix": "nx-module", | |
| "body": [ | |
| "(function (${module}) {", | |
| "\t'use strict';", | |
| "", | |
| "\t$0", |
This file contains hidden or 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
| function buildFunctions() { | |
| var arr = []; | |
| for (var i = 0; i < 3; i++) { | |
| arr.push( | |
| function() { | |
| console.log(i); // takes the last/current value of i on execution | |
| } |
This file contains hidden or 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
| function makeGreeting(language) { | |
| return function(firstname, lastname) { | |
| if (language === 'en') { | |
| console.log('Hello ' + firstname + ' ' + lastname); | |
| } | |
| if (language === 'es') { | |
| console.log('Hola ' + firstname + ' ' + lastname); |
This file contains hidden or 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 arr1 = [1,2,3]; | |
| console.log(arr1); | |
| function mapForEach(arr, fn){ | |
| var newArr = []; | |
| for (var i = 0; i < arr.length; i++) { | |
| newArr.push(fn(arr[i])); |
This file contains hidden or 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
| // Sample library that provides simple greetings by language | |
| // The semicolon is useful to finish up code properly which | |
| // was loaded and executed before this code (maybe another | |
| // library that didn't finish up with a semicolon, properly). | |
| ;(function(global, $){ | |
| // The main method that creates a new Greetr object |
OlderNewer