Skip to content

Instantly share code, notes, and snippets.

Matthew Eernisse mde

Block or report user

Report or block mde

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ember_obj_serialize.txt
var Foo = Ember.Object.extend({zerb: function () {}});
undefined
var bar = Foo.create();
undefined
JSON.stringify(bar);
"{}"
bar.set('asdf', 'ASDF');
Class {asdf: "ASDF", __ember1458770221107: null, __nextSuper: undefined, __ember_meta__: Object}
JSON.stringify(bar);
"{"asdf":"ASDF"}"
View fitler_gh_notifications.js
function filterGhNotifications() {
var sourceLabel = GmailApp.getUserLabelByName('GH');
var addedLabel = GmailApp.getUserLabelByName('GH -- mde');
var pat = /@mde/;
var threads;
var foundThreads = [];
threads = sourceLabel.getThreads(0, 20);
threads.forEach(function (thread) {
var messages = thread.getMessages();
var subject;
@mde
mde / iterative_cps.js
Created Sep 22, 2015
Iterative, but CPS
View iterative_cps.js
var iterativeRunner = function (arr) {
var funcs = arr.map(function (item, index) {
return function () {
item(function () {
if (funcs[index + 1]) {
funcs[index + 1]();
}
});
};
});
@mde
mde / gist:ae752b3bb4a66c152371
Created Jun 20, 2015
PropagateAction mixin
View gist:ae752b3bb4a66c152371
import Ember from 'ember';
export default Ember.Mixin.create({
_sendActionPropagateChannel: '_sendActionPropagateChannel',
actions: {
_sendActionPropagateChannel: function () {
try {
this.send.apply(this, arguments);
}
catch (err) {
View gist:3825a3732effbe76ee62
var foo = {
a: function () {
console.log(this);
}
};
foo.a(); // Logs the foo obj
foo['a'](); // Same, logs the foo obj
View gist:8c5c8a3cd48d6c2dd545
var foo = function (seed) {
var currVal = seed;
var incrementor = function () {
currVal++;
console.log(currVal);
};
return incrementor;
};
@mde
mde / gist:81b131ff6810ed7c4e0e
Last active Aug 29, 2015
Simple left-to-right mixin
View gist:81b131ff6810ed7c4e0e
var mixin = function () {
var args = Array.prototype.slice.call(arguments);
var target = args.shift();
var source = args.shift();
// We don't need no hasOwnProperty checks!
for (var prop in source) {
target[prop] = source[prop];
}
if (args.length) {
args.unshift(target);
View gist:82a934b6a3fa1da604be
> var foo = function (a) { return function (b) { return a * b; }; };
undefined
> var bar = foo(2);
undefined
> bar(5);
10
> var foo = function () { console.log(arguments.length); };
undefined
> foo();
0
View riakpbc domains
var http = require('http')
, domain = require('domain')
, riakpbc = require('./index')
, riak = riakpbc.createClient({host: 'localhost', port: 8087});
http.createServer(function (req, res) {
var dmn = domain.create();
dmn.on('error', function (err) {
console.dir(arguments);
View gist:6df28c379d544e02c13d
bash-3.2$ npm install
npm http GET https://registry.npmjs.org/filelist
npm http GET https://registry.npmjs.org/minimatch/0.2.3
npm http 200 https://registry.npmjs.org/filelist
npm http GET https://registry.npmjs.org/filelist/-/filelist-0.0.2.tgz
npm http 200 https://registry.npmjs.org/minimatch/0.2.3
npm http GET https://registry.npmjs.org/minimatch/-/minimatch-0.2.3.tgz
npm http 200 https://registry.npmjs.org/filelist/-/filelist-0.0.2.tgz
npm WARN package.json filelist@0.0.2 No README.md file found!
npm http 200 https://registry.npmjs.org/minimatch/-/minimatch-0.2.3.tgz
You can’t perform that action at this time.