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
"use strict"; | |
const appConfig = require('../config.js'); | |
const mongoose = require('mongoose'); | |
mongoose.connect(appConfig.MONGOLAB_URI); | |
mongoose.connection.on('error', (err) => { | |
console.log('Error: Could not connect to MongoDB. Did you forget to run `mongod`?'); | |
}); | |
mongoose.connection.once('open', (err) => { | |
console.log('Connected to MongoDb'); | |
}); |
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
"use strict"; | |
//npm install moment bluebird aws crypto fs-plus --save | |
const moment = require('moment'); | |
const Promise = require('bluebird'); | |
const AWS = require('aws-sdk'); | |
const crypto = require('crypto'); | |
const fs = require('fs-plus'); |
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
"use strict"; | |
const request = require('request'); | |
const fs = require('fs'); | |
const req = require('request-promise'); | |
const async = require('asyncawait/async'); | |
const await = require('asyncawait/await'); | |
const appConfig = require('../config.js'); | |
//hoist |
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
"use strict"; | |
//npm i express morgan body-parder method-override path cors moment request bluebird lodash --save | |
const express = require('express'); | |
const app = express(); | |
var server = require('http').createServer(app); | |
const morgan = require('morgan'); | |
const bodyParser = require('body-parser'); | |
const methodOverride = require('method-override'); |
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
"use strict"; | |
var gulp = require('gulp'), | |
notify = require('gulp-notify'), | |
connect = require('gulp-connect'), | |
gulp.task('default', ['watch', 'connect']); | |
gulp.task('connect', function() { | |
connect.server({ |
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
"use strict"; | |
(function() { | |
angular.module('weatherApp') | |
.factory('weatherSvc', LocationSvc); | |
WeatherSvc.$inject = ['$q', '$window', '$http', 'CONSTANTS']; | |
function WeatherSvc($q, $window, $http, CONSTANTS) { |
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
"use strict"; | |
;(function() { | |
angular | |
.module('xxx') | |
.controller('HomeCtrl', HomeCtrl); | |
HomeCtrl.$inject = ['$scope', '$http', '$state', '$location', '$stateParams', 'LocalStorage', 'QueryService', 'Account', 'Videos', 'toastr']; |
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
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> | |
<!DOCTYPE html> | |
<html ng-app="scormify" ng-strict-di> | |
<head> | |
<base href="/"> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
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
function arrCollection() { | |
this.createArray = function(len) { | |
var ret = []; | |
for(var i = 0; i < len; i++) { | |
ret.push(i); | |
} | |
return ret; | |
}; | |
this.reduceToPrime = function(arr) { | |
var ret = arr.filter(function(value) { |
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
//1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... | |
function fibonacci(n) { | |
var a = 1; | |
var b = 0; | |
var temp; | |
while (n >= 0) { | |
temp = a; | |
a = a + b; | |
b = temp; |