Skip to content

Instantly share code, notes, and snippets.

Dan laterbreh

  • Reno, NV
Block or report user

Report or block laterbreh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
laterbreh / db.js
Last active Mar 24, 2017
Creating a wrapper for promise based co-routine functions
View db.js
//This is the DB file im writing the fucntions in
const redis = Promise.promisifyAll(require('redis'));
const client = redis.createClient();
const Promise = require('bluebird');
const {coroutine: co} = require('bluebird'); //Alias coroutine
const wrapper = require('./lib.js');
module.exports.SomeFunction(key, value) {
return wrapper(function(){
let set = yield client.set(key, value);
laterbreh / main.js
Last active Jan 23, 2017
Using Bluebird's Promise.Coroutine to write asynchronous code "synchronously" in Node 7.4.0 and Express 4
View main.js
'use strict'
const express = require('express');
const app = express();
const Promise = require('bluebird');
const {coroutine: co} = require('bluebird'); //Alias coroutine
app.listen(3000, function () {
console.log('Example app listening on port 3000!')
app.get('/', (req, res)=>{
laterbreh / gist:13fd609e6724505bd14a8435287e9f94
Created Aug 9, 2016
Collect all dependencies for a project for easy copy paste into package.json. Thanks SO -
View gist:13fd609e6724505bd14a8435287e9f94
var fs = require("fs");
function main() {
fs.readdir("./node_modules", function (err, dirs) {
if (err) {
if (dir.indexOf(".") !== 0) {
laterbreh / Gruntfile.js
Created Jun 11, 2016
Easy Grunt Tutorial
View Gruntfile.js
module.exports = function(grunt) {
pkg: grunt.file.readJSON('package.json'),
concat: {
css: {
src: [
'css/*' //What folder to look at for your css files
dest: 'combined.css' //Where or what to name your concat css
laterbreh / Angular seed with sockets example - app.js
Last active May 17, 2017
Basic ping pong with angular and sockets. This uses an express backend to communicate the emit events.
View Angular seed with sockets example - app.js
'use strict';
// Declare app level module which depends on views, and components
angular.module('myApp', [
laterbreh / Express 4 and Passing to routes - app.js
Last active Jan 22, 2020
Express 4 and Passing to routes.
View Express 4 and Passing to routes - app.js
var app = express(); = require('')();
var routes = require('./routes/index')(;
app.use('/', routes);
laterbreh / storeImgInMongoWithMongoose.js
Created Sep 28, 2015 — forked from aheckmann/storeImgInMongoWithMongoose.js
store/display an image in mongodb using mongoose/express
View storeImgInMongoWithMongoose.js
* Module dependencies
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
You can’t perform that action at this time.