Skip to content

Instantly share code, notes, and snippets.

Portlandia Guide

Eat & Drink in Pearl District

var Filter = require('broccoli-filter');
var compile = require('es6-arrow-function').compile;
module.exports = ArrowFunctionFilter;
ArrowFunctionFilter.prototype = Object.create(Filter.prototype);
ArrowFunctionFilter.prototype.constructor = ArrowFunctionFilter;
function ArrowFunctionFilter (inputTree, options) {
if (!(this instanceof ArrowFunctionFilter)){
# app/assets/javascripts/ember-app/templates/partials/_header.js.coffee
%nav.navbar.navbar-default.navbar-fixed-top
.container
.navbar-header
%btn.navbar-toggle{ data: { target: '.navbar-collapse', toggle: 'collapse' }, type: 'button' }
%span.sr-only Toggle Navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= hb 'link-to "index" class="navbar-brand"' do
// instead of this
{
meth1: function() {
...
}.on('init'),
meth2: function() {
...
}.on('init'),
meth3: function() {
...
@qrush
qrush / Gemfile
Last active December 10, 2015 21:38
Simple Rakefile and Gemfile for using SCSS and CoffeeScript with Jekyll without plugins
source 'https://rubygems.org'
gem 'jekyll'
gem 'maruku'
gem 'rake'
gem 'sass'
gem 'coffee-script'
@kevinthompson
kevinthompson / commented_regex.rb
Last active December 19, 2015 15:38
An example of a commented regex block encapsulated in a method.
def email_pattern
%r{
^[A-Z0-9._%+-]+ # Beginning with one or more valid characters (letters, numbers, period, etc.)
@ # A literal "at" sign
[A-Z0-9.-]+ # One or more letters, numbers, period, or dash
\. # A literal period
[A-Z]{2,4}$ # Ending with a two to four character text domain extension
}ix # Flags: Ignore whitespace and ignore letter case
end
@wycats
wycats / app.js
Last active February 11, 2016 16:08
App.Router.map(function() {
this.resource('post', { path: '/posts/:post_id' });
});
App.PostRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('post', params.post_id);
}
});
@jed
jed / LICENSE.txt
Created May 25, 2011 14:15 — forked from 140bytes/LICENSE.txt
select DOM elements by ID, tag name, or class name
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jhorneman
jhorneman / async data loading in Flux.md
Last active August 22, 2016 02:18
Thoughts on where to do async data loading in Flux

Async data loading in Flux

I've been working with Flux a lot recently, and one of the questions I've been struggling with is in which part of the Flux cycle to put my asynchronous data requests.

Here are some different opinions:

The diagram

The famous Flux diagram puts them in the action creators.

The chat example

@addyosmani
addyosmani / jquery.tinypubsub.js
Created October 27, 2011 10:10 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery 1.7
/*!
* jQuery Tiny Pub/Sub for jQuery 1.7 - v0.1 - 27/10/2011
* Based on @cowboy Ben Alman's REALLY tiny pub/sub.
* 1.7 specific updates by @addyosmani.
* Copyright maintained by @cowboy.
* Dual licensed under the MIT and GPL licenses.
*/
(function($){