Skip to content

Instantly share code, notes, and snippets.

View jrutter's full-sized avatar

Jake Rutter jrutter

View GitHub Profile
@martinnormark
martinnormark / hapijs-routes.js
Created March 26, 2016 06:23
Load routes from separate files with hapi.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 July 8, 2022 01:32
Minimal Webpack DllPlugin example

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 June 19, 2015 10:53
A script that we use at Lateral to generate our documentation
#!/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
@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

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 October 2, 2015 18:18
Appcelerator Gruntjs
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 March 16, 2014 09:10
How to Floor, Round, Ceiling in JSTL/EL
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 September 4, 2020 23:25
Format percentages in AngularJS
// 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 August 12, 2022 01:22
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.
// 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 October 2, 2013 10:52
Simple toggleClass implemented in AngularJS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.is-active {
color: red;
}
</style>
@victorb
victorb / app.js
Created September 24, 2013 16:37
Easy AngularJS Directive for Google Places Autocomplete
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};