Skip to content

Instantly share code, notes, and snippets.

@gyllstromk
gyllstromk / modularizing_jshint_rules.md
Created September 6, 2013 15:41
Modularizing your organization's JSHint rules

The typical use of jshint involves including rules in a .jshintrc or Gruntfile.js. This does not scale to multi-repo organizations, as .jshintrc files must be made in each repo, and organization-widge changes to these rules must be copied to each repo's .jshintrc file.

Fortunately, it's easy to formalize and enforce style standards in your organization's Javascript. Here we describe the pattern we use.

The overview:

  1. Formalize your style into JSHint rules (i.e. identify the rules you would place in a .jshintrc file)
  2. Centralize access to jshint rules via a packaging pattern (described below)
  3. Require jshint conformance in unit testing/code reviews/deployments.
@gyllstromk
gyllstromk / cheer.js
Last active December 20, 2015 05:39
Cheer me up
String.prototype.cheerUp = function () {
return this.replace(/☹/g, '☺');
};
@gyllstromk
gyllstromk / ember_handlebars_markdown_helper.js
Last active April 13, 2023 19:33
Render markdown as HTML in Ember via `registerBoundHelper`. This example uses https://github.com/evilstreak/markdown-js.
Ember.Handlebars.registerBoundHelper('markdown', function (content) {
return new Handlebars.SafeString(markdown.toHTML(content));
});