Skip to content

Instantly share code, notes, and snippets.

Jake Rutter jrutter

Block or report user

Report or block jrutter

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
@martinnormark
martinnormark / hapijs-routes.js
Created Mar 26, 2016
Load routes from separate files with hapi.js
View hapijs-routes.js
module.exports = [
{ method: 'GET', path: '/users', handler: function () {} },
{ method: 'GET', path: '/users/{id}', handler: function () {} }
];
---
var cart = require('./cart');
var user = require('./user');
@robertknight
robertknight / Build.md
Last active May 28, 2019
Minimal Webpack DllPlugin example
View Build.md

Compile with:

webpack --config vendor.webpack.config.js
webpack --config app.webpack.config.js

Use with the following index.html

@betamax
betamax / generate-docs.sh
Created Jun 19, 2015
A script that we use at Lateral to generate our documentation
View generate-docs.sh
#!/bin/sh
# Which md files to compile
declare -a arr=("hybrid-recommender" "text-matching" "pre-populated-recommenders")
# Now loop through the above array
for i in "${arr[@]}"
do
# Where to store the documentation
View on-jsx.markdown

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@stephenfeather
stephenfeather / Gruntfile.js
Last active Oct 2, 2015
Appcelerator Gruntjs
View Gruntfile.js
module.exports = function(grunt) {
require('time-grunt')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
CHANGELOG: '',
// add tiapp.xml changes to the repo
gitadd: {
versionBump: {
options: {
@stuwilli
stuwilli / gist:9580481
Created Mar 16, 2014
How to Floor, Round, Ceiling in JSTL/EL
View gist:9580481
Floor(N) -> ${N-(N%1)}
Ceiling(N) -> ${N+(1-(N%1))%1}
Round(N) -> ${N+((N%1>0.5)?(1-(N%1))%1:-(N%1))}
@jeffjohnson9046
jeffjohnson9046 / percent-filter.js
Last active Mar 7, 2019
Format percentages in AngularJS
View percent-filter.js
// In app.js or main.js or whatever:
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']);
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17).
myApp.filter('percentage', ['$filter', function ($filter) {
return function (input, decimals) {
return $filter('number')(input * 100, decimals) + '%';
};
}]);
@jeffcogswell
jeffcogswell / q_example.js
Last active Nov 27, 2018
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
View q_example.js
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick
@mrosati84
mrosati84 / toggleClass.html
Created Oct 2, 2013
Simple toggleClass implemented in AngularJS
View toggleClass.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.is-active {
color: red;
}
</style>
@victorb
victorb / app.js
Created Sep 24, 2013
Easy AngularJS Directive for Google Places Autocomplete
View app.js
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};
You can’t perform that action at this time.