Skip to content

Instantly share code, notes, and snippets.

Nathan Brown ngbrown

Block or report user

Report or block ngbrown

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

Folder Structure


  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
branneman /
Last active Jul 17, 2019
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

OlegIlyenko / Event-stream based GraphQL
Last active Jul 16, 2019
Event-stream based GraphQL subscriptions for real-time updates
View Event-stream based GraphQL

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

deiu / linkheaderparser.js
Last active Jul 1, 2019
Parse HTTP Link header in Javascript
View linkheaderparser.js
// parse a Link header
// Link:<>; rel=meta
// var r = parseLinkHeader(xhr.getResponseHeader('Link');
// r['meta'] outputs
function parseLinkHeader(header) {
var linkexp = /<[^>]*>\s*(\s*;\s*[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g;
var paramexp = /[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g;
jmangelo / AppConfig.Transformation.targets
Created Jun 21, 2010
VS 2010 RTM - MSBuild Project file for App.config XML transformations.
View AppConfig.Transformation.targets
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="">
<!-- 20110224 : Ryan Milligan : Created OverrideAppConfigWithTargetPath target to fix ClickOnce deploy bug -->
<!-- 20100827 : João Angelo : Fixed bug when using Publish command within Visual Studio -->
<!-- Prevent circular dependency on Build target -->
<!-- Override project config file name (By default is set to Web.config) -->
thoemmi / PreBuild.targets.xml
Created Sep 14, 2012
Embed referenced assemblies, because ILMerge won't work with WPF applications
View PreBuild.targets.xml
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" xmlns="">
Originally written by Daniel Chambers (
<Target Name="EmbedReferencedAssemblies" AfterTargets="ResolveAssemblyReferences">
<!-- get list of assemblies marked as CopyToLocal -->
<AssembliesToEmbed Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)' == '.dll'"/>
roryf / DeliminatorSeparatedPropertyNamesContractResolver.cs
Created Jun 23, 2011
Snake case (underscore separated) property name resolver for Newtonsoft.Json library
View DeliminatorSeparatedPropertyNamesContractResolver.cs
public class DeliminatorSeparatedPropertyNamesContractResolver : DefaultContractResolver
private readonly string _separator;
protected DeliminatorSeparatedPropertyNamesContractResolver(char separator) : base(true)
_separator = separator.ToString();
protected override string ResolvePropertyName(string propertyName)
alex-seville / jsViews in Backbone
Created Jun 7, 2012
Using jsViews in backbone to make an editable area (
View jsViews in Backbone
var Form = Backbone.Model.extend({});
var FormView = Backbone.View.extend({
events: {
"click .save": "save",
"click .edit": "edit",
"click .cancel": "cancel"
initialize: function() {
//set up our input form template
You can’t perform that action at this time.