Skip to content

Instantly share code, notes, and snippets.

View moimikey's full-sized avatar
:shipit:
ship it

Michael Scott Hertzberg moimikey

:shipit:
ship it
View GitHub Profile
anonymous
anonymous / gist:7407896
Created November 11, 2013 04:31
Small, moderately scale-able library boilerplate using an immediately invoked object expression
!{
//convenience methods here for create and expose via this
create: function(options){
//constructor logic here
var created = Object.create(this.fn);
var args = [].slice.call(arguments);
this.plugins.forEach(function(plugin){
plugin.apply(created, args);
});
return created;
@brian-mann
brian-mann / gist:7477964
Created November 15, 2013 02:04
automating tagName's and columns for itemViews
class Views.CompositeView extends Marionette.CompositeView
itemViewEventPrefix: "childview"
itemViewOptions: (model, index) ->
options = {}
options.tagName = "tr" if @isTbody()
options.tagName = "li" if @isUl()
options.tableColumns = @$el.find("th").length if @isTbody()
options
@dherman
dherman / realms-api.md
Last active September 7, 2024 17:42
ES6 Realms API

Notational Conventions

This section describes the conventions used here to describe type signatures.

A [T] is an array-like value (only ever used read-only in this API), i.e., one with an integer length and whose indexed properties from 0 to length - 1 are of type T.

A type T? should be read as T | undefined -- that is, an optional value that may be undefined.

Realms

@JamieMason
JamieMason / unfollow.js.md
Last active July 22, 2025 08:53
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

By @foldleft.bsky.social, see also Unfollow everyone on bsky.app.

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
@moimikey
moimikey / konami.coffee
Last active December 29, 2015 03:19
KONAMIIIIIIIIIIII KYYYYAHHHHHHHHHHHHH!!!!
@MM.module 'EasterEggApp', (EE, App, Backbone, Marionette, $, _) ->
# up, up, down, down, left, left, right, right, a, enter
EE.sequence = [38, 38, 40, 40, 37, 37, 39, 39, 65, 13]
EE.pressed = []
EE.on
'start': ->
$(window).on 'keyup.konami', EE.pressedKey
'stop': ->
$(window).off '.konami'
@swannodette
swannodette / pure.js
Last active December 30, 2015 09:39
var PureComponent = React.createClass({
shouldComponentUpdate: function(nextProps, nextState) {
return !equals(this.props.value, nextProps.value);
},
render: function() {
return this.props.children();
}
});
var pure = function(value, childrenThunk) {
@gaearon
gaearon / promise_scheduler.js
Last active March 29, 2018 06:12
Q promise concurrency limiter
'use strict';
var q = require('q');
/**
* Constructs a function that proxies to promiseFactory
* limiting the count of promises that can run simultaneously.
* @param promiseFactory function that returns promises.
* @param limit how many promises are allowed to be running at the same time.
* @returns function that returns a promise that eventually proxies to promiseFactory.
@stormwarning
stormwarning / __wordpress.php
Last active October 9, 2024 00:24
WordPress PROTIPs
/**
* A selection of handy code snippets, plugins, and best practices for WordPress development.
*
*/

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.

@mollerse
mollerse / gulpfile-express.js
Last active March 28, 2021 20:07
Gulpfile for livereload + static server
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,