Skip to content

Instantly share code, notes, and snippets.

madhums / graphql-go-mongodb-example.go
Created May 6, 2019 — forked from trunet/graphql-go-mongodb-example.go
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
View graphql-go-mongodb-example.go
// Embedded in this article
package main
import (
View browserify_for_webpack_users.markdown

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

madhums / AngularJS-ES6-Test-Skeleton
Last active Jun 30, 2017 — forked from busypeoples/AngularJS-ES6-Test-Skeleton
AngularJS - Karma, Jasmine, Browserify, Stringify - ES6 Test Setup
We couldn’t find that file to show.
madhums / gulpfile.js
Created Jul 18, 2015 — forked from danharper/gulpfile.js
ES6 project with Babel, Browserify & Gulp
View gulpfile.js
'use strict';
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
View 1088.js
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
console.log(' mongoose version: %s', mongoose.version);
mongoose.connect('localhost', 'testing_1088');
mongoose.connection.on('error', function () {
madhums / gist:4135481
Created Nov 23, 2012 — forked from cjohansen/gist:4135065
Naming this in nested functions
View gist:4135481


If you must nest functions in a way that requires access to multiple this', alias outer this to something meaningful - describe the value it's holding. Treat this as the invisible first argument.

In general though, avoiding the situation (nested functions and frivolous use of this) will frequently produce clearer results.

Naming this in nested functions

I was accidentally included in a discussion on how to best name this in nested functions in JavaScript. +1's were given to this suggestion of using _this.

Giving style advice on naming nested this without a meaningful context isn't too helpful in my opinion. Examples below have been altered to have at least some context, although a completely contrived and stupid one.

madhums /
Created Oct 24, 2012 — forked from domenic/
You're Missing the Point of Promises

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
madhums / gh-like.css
Created Oct 6, 2012 — forked from robsimmons/gh-like.css
GitHub-esque syntax highlight CSS
View gh-like.css
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;
madhums / gist:3311709
Created Aug 10, 2012 — forked from dvessel/gist:1478685
TextMate 2 .tm_properties
View gist:3311709

This is all based on the [alpha release][1].


From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

madhums / express-pagination.js
Created Jul 23, 2012 — forked from xjamundx/express-pagination.js
sample pagination using express route-specific middleware
View express-pagination.js
// articles per page
var limit = 10;
// pagination middleware function sets some
// local view variables that any view can use
function pagination(req, res, next) {
var page = parseInt( || 1,
num = page * limit;
db.articles.count(function(err, total) {
res.local("total", total);