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)
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.


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:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

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'"/>
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;
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)
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
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) -->