Skip to content

Instantly share code, notes, and snippets.

View jayphelps's full-sized avatar
💭
I may be slow to respond.

Jay Phelps jayphelps

💭
I may be slow to respond.
View GitHub Profile
@DmitrySoshnikov
DmitrySoshnikov / Recursive-descent-backtracking.js
Last active January 3, 2024 17:15
Recursive descent parser with simple backtracking
/**
* = Recursive descent parser =
*
* MIT Style License
* By Dmitry Soshnikov <[email protected]>
*
* In this short lecture we'll cover the basic (non-predictive, backtracking)
* recursive descent parsing algorithm.
*
* Recursive descent is an LL parser: scan from left to right, doing
@kitten
kitten / Store.js
Created June 25, 2015 22:58
A generic Store factory, that utilises Immutable.js and RxJS
import { EventEmitter } from "events";
import { Observable } from "rx";
import { Map, List } from "immutable";
export default {
createStore(extend) {
const CHANGE_EVENT = "change";
const EventListener = Object.assign({}, EventEmitter.prototype, {
changed() {
this.emit(CHANGE_EVENT);
@rniwa
rniwa / gist:2f14588926e1a11c65d3
Last active August 29, 2015 14:19
Imperative API for Node Distribution in Shadow DOM

Imperative API for Node Distribution in Shadow DOM

There are two approaches to the problem depending on whether we want to natively support redistribution or not.

To recap, a redistribution of a node (N_1) happens when it's distributed to an insertion point (I_1) inside a shadow root (S_1), and I_1's parent also has a shadow root which contains an insertion point which ends picking up N_1. e.g. the original tree may look like:

(host of S_1) - S_1
  + N_1         + (host of S_2) - S_2
                   + I_1           + I_2
@bobpace
bobpace / event-stream.js
Created March 18, 2015 23:35
Koa.js server sent events with Rx Observables
module.exports = function eventStream() {
return function *(next) {
this.req.setTimeout(0); //no timeout
this.type ='text/event-stream; charset=utf-8';
this.set('Cache-Control', 'no-cache');
this.set('Connection', 'keep-alive');
this.set('Transfer-Encoding', 'chunked');
yield* next;
}
export default {
getInitialState() {
const data = {};
this.subscribe(this.props, this.context, (key, value) => {
data[key] = value;
});
this.unsubscribe();
return { data };
@tim-evans
tim-evans / document-title.js
Created February 19, 2015 20:39
Document Title component
import Ember from "ember";
export default Ember.Component.extend({
isVirtual: true,
tagName: '',
render: function (buffer) {
let titleTag = document.getElementsByTagName('title')[0];
this._morph = buffer.dom.appendMorph(titleTag);
this._super.apply(this, arguments);
}
@dnegstad
dnegstad / Brocfile.js
Last active January 2, 2019 17:50
Polymer WebComponents in ember-cli >= 0.0.41
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var vulcanize = require('broccoli-vulcanize');
var app = new EmberApp();
var polymerVulcanize = vulcanize('app', {
input: 'elements.html',
output: 'assets/vulcanized.html',
@hparra
hparra / fulcrum.console.md
Last active August 25, 2023 19:29
fulcrum.console Conversion Notes

fulcrum.console Conversion Notes

When possible we try to group changes.

Root

dotfiles

Add predefs to .jshintrc

@jashkenas
jashkenas / semantic-pedantic.md
Last active May 7, 2025 01:36
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@rwjblue
rwjblue / ember-master-in-ember-cli-app.md
Last active October 10, 2016 23:01
Developing on Ember master (linked locally), with an Ember CLI application.

From a terminal run the following commands:

git clone [email protected]:emberjs/ember.js
cd ember.js
npm install
npm start

While that is running open another terminal and run the following (starting from the ember.js folder you cloned a moment ago):