Skip to content

Instantly share code, notes, and snippets.

@Thingyiot
Thingyiot / Passport.js
Created May 7, 2015 02:06
Passport gist
var express = require('express')
, passport = require('passport')
, LocalStrategy = require('passport-local').Strategy
, mongodb = require('mongodb')
, mongoose = require('mongoose')
, bcrypt = require('bcrypt')
, SALT_WORK_FACTOR = 10;
mongoose.connect('localhost', 'test');
var db = mongoose.connection;
@Thingyiot
Thingyiot / mergeSort.js
Created June 26, 2015 16:16
Merge two Sorted Arrays
(function mergeSort(array1, array2) {
var i = 0;
var j = 0;
var result = [];
while (i <= array1.length && j <= array2.length) {
if (array1[i] > array2[j]) {
if (typeof array2[j] !== 'undefined') {
result.push(array2[j]);
@Thingyiot
Thingyiot / mergeSort.js
Created June 26, 2015 16:17
Merge two Sorted Arrays
(function mergeSort(array1, array2) {
var i = 0;
var j = 0;
var result = [];
while (i <= array1.length && j <= array2.length) {
if (array1[i] > array2[j]) {
if (typeof array2[j] !== 'undefined') {
result.push(array2[j]);