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
| .directive('httpSrc', [ | |
| '$http', function ($http) { | |
| var directive = { | |
| link: link, | |
| restrict: 'A' | |
| }; | |
| return directive; | |
| function link(scope, element, attrs) { | |
| var requestConfig = { |
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
| angular | |
| .module( 'common.cache', [] ) | |
| .factory( 'CacheService', CacheService ); | |
| function CacheService(){ | |
| var service = {}; | |
| service.cache = {}; |
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
| // returns an object that does not itself possess "var a" | |
| // The closure gives indirect access to a, via the public getter and setter. | |
| function f() { | |
| var a = 1; | |
| return { | |
| getA: function() { | |
| return a; | |
| }, | |
| setA: function( A ) { |
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 crypto = require('crypto'), | |
| algorithm = 'aes-256-ctr', | |
| password = '6LehWQcTAAAAADgH-I5WmmkuDFFJ_pMr_866zz17'; | |
| function encrypt(text){ | |
| var cipher = crypto.createCipher(algorithm,password) | |
| var crypted = cipher.update(text,'utf8','hex') | |
| crypted += cipher.final('hex'); | |
| return crypted; | |
| } |
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
| //https://www.npmjs.com/package/tv | |
| var Hapi = require('hapi'); | |
| var Tv = require('tv'); | |
| // Create a server with a host and port | |
| var server = new Hapi.Server(); | |
| server.connection({ | |
| host: 'localhost', | |
| port: 8000 |
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 getUTCTimeFromTimeStamp(timestamp) { | |
| var currentTime = new Date(timestamp), | |
| unixTime = new Date( | |
| currentTime.getUTCFullYear(), | |
| currentTime.getUTCMonth(), | |
| currentTime.getUTCDate(), | |
| currentTime.getUTCHours(), | |
| currentTime.getUTCMinutes(), | |
| currentTime.getUTCSeconds() |
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 Promise = require('bluebird'), | |
| nodemailer = Promise.promisifyAll(require('nodemailer')), | |
| sendGridTransport = require('nodemailer-sendgrid-transport'); | |
| var options = { | |
| auth: { | |
| api_user: process.env.SENDGRID_USERNAME, | |
| api_key: process.env.SENDGRID_PASSWORD | |
| } | |
| } |
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 Hapi = require('hapi'), | |
| boom = require('boom'); | |
| // Create a server with a host and port | |
| var server = new Hapi.Server(); | |
| server.connection({ | |
| host: 'localhost', | |
| port: 8000 | |
| }); |