Skip to content

Instantly share code, notes, and snippets.

View miseeger's full-sized avatar
💭
continuously learning ...

Michael Seeger miseeger

💭
continuously learning ...
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
namespace Sample
{
public class CrossOriginSupportModule : IHttpModule
{
var mongoose = require('mongoose');
var repository = function (modelName) {
var self = this;
self.Model = require('../models/' + modelName);
self.FindById = function (id, cb) {
self.FindOne({
@miseeger
miseeger / json.vbs
Last active August 29, 2015 14:27 — forked from atifaziz/json.vbs
JSON Encoder for VBScript
'==========================================================================
' 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
'
@miseeger
miseeger / AuthController.js
Created October 23, 2015 08:30 — forked from sobeit/AuthController.js
Sails+Passport-Google-OAuth
/**
* 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`)
@miseeger
miseeger / beforeBlueprint.js
Created October 23, 2015 08:31 — forked from mphasize/beforeBlueprint.js
Sails-beforeBlueprint-Policy
/**
* 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' );
@miseeger
miseeger / javascript.json
Last active November 12, 2015 20:56
VSCode Snippets for NodeJS with Express
{
// ----- NodeJS with Express ----------------------------------------------
"NodeJS Express Empty Module": {
"prefix": "nx-module",
"body": [
"(function (${module}) {",
"\t'use strict';",
"",
"\t$0",
@miseeger
miseeger / closures.js
Last active November 19, 2015 14:54
Example for JS Closures
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
}
@miseeger
miseeger / funClosure.js
Last active November 19, 2015 15:13
Function factory using Closures
function makeGreeting(language) {
return function(firstname, lastname) {
if (language === 'en') {
console.log('Hello ' + firstname + ' ' + lastname);
}
if (language === 'es') {
console.log('Hola ' + firstname + ' ' + lastname);
@miseeger
miseeger / funBasics.js
Last active November 19, 2015 16:35
Basic functional programming examples
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]));
@miseeger
miseeger / Greeter.js
Last active November 20, 2015 19:47
Greeter-Sample-Library using jQuery
// 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