Skip to content

Instantly share code, notes, and snippets.

@marr
marr / .js
Created August 2, 2017 23:17
// Use `.hbs` for extensions and find partials in `views/partials`.
const hbs = require('express-hbs');
app.engine('hbs', hbs.express4({
partialsDir: __dirname + '/views/partials'
}));
app.set('view engine', 'hbs');
app.set('views', __dirname + '/views');
@marr
marr / .block
Last active August 3, 2017 00:40
fresh block
license: mit
@marr
marr / .block
Last active August 1, 2017 23:37
Valley Fair - Topojson
license: mit
@marr
marr / .block
Last active July 18, 2017 23:23
Valley Fair Level 1 - Interactions
license: mit
@marr
marr / .block
Created July 18, 2017 20:15
fresh block
license: mit
@marr
marr / .block
Created July 18, 2017 20:15
fresh block
license: mit
@marr
marr / .block
Last active August 1, 2017 23:25
Valley Fair Level 1 - Interactions
license: mit
import { pointInPolygon } from './utils';
const Vector = (x, y) => ({ x, y });
it('detects points in polygons', () => {
const vertices = [
[1, 1],
[1, 4],
[4, 4],
[4, 1]
@marr
marr / .rb
Last active June 9, 2017 22:04
class Slug < ActiveRecord::Base
before_validation :generate_slug
validates :slug, presence: true, uniqueness: true
private
def generate_slug
self.slug = self.value.parameterize
end
end
class Slug < ActiveRecord::Base
slugify :override_value, :to => :slug
validates :slug, presence: true, uniqueness: true
end