Skip to content

Instantly share code, notes, and snippets.

View dwickern's full-sized avatar

Derek Wickern dwickern

View GitHub Profile
@dwickern
dwickern / UnorderedTestKit.scala
Last active August 29, 2015 14:09
Akka Testkit mixin for testing unordered messages
import akka.testkit._
import org.scalatest._
import scala.collection.mutable
import scala.concurrent.duration._
import scala.reflect.ClassTag
import scala.util._
/**
* Extensions to [[akka.testkit.TestKit]] for testing actors
@dwickern
dwickern / Macros.scala
Last active September 23, 2016 20:16
Scala "nameOf" macro: get the name of an identifier as a string at compile-time!
import scala.annotation.tailrec
import scala.language.experimental.macros
import scala.reflect.macros.blackbox
// UPDATE: now published for your convenience!
// https://github.com/dwickern/scala-nameof
object Macros {
def nameOfImpl(c: blackbox.Context)(x: c.Tree): c.Tree = {
import c.universe._
@dwickern
dwickern / npm-debug.log
Created November 18, 2015 19:29
npm install error -- Could not get current working directory: No such file or directory
This file has been truncated, but you can view the full file.
72036 silly gunzTarPerm extractEntry node_modules/node-gyp/node_modules/path-array/node_modules/array-index/README.md
72037 silly gunzTarPerm modified mode [ 'node_modules/node-gyp/node_modules/path-array/node_modules/array-index/README.md',
72037 silly gunzTarPerm 420,
72037 silly gunzTarPerm 438 ]
72038 silly gunzTarPerm extractEntry node_modules/node-gyp/node_modules/path-array/node_modules/array-index/index.js
72039 silly gunzTarPerm modified mode [ 'node_modules/node-gyp/node_modules/path-array/node_modules/array-index/index.js',
72039 silly gunzTarPerm 420,
72039 silly gunzTarPerm 438 ]
72040 silly gunzTarPerm extractEntry node_modules/node-gyp/node_modules/path-array/node_modules/array-index/test.js
72041 silly gunzTarPerm modified mode [ 'node_modules/node-gyp/node_modules/path-array/node_modules/array-index/test.js',
@dwickern
dwickern / components.async-image-wrapper.js
Created August 11, 2016 18:28 — forked from chrism/components.async-image-wrapper.js
Non working example using Ember.run
import Ember from 'ember';
export default Ember.Component.extend({
imageLoaded: 'image not yet loaded',
// purely to make sure image loads each time and
// is not cached for testing
volatileSrc: Ember.computed('src', function(){
return this.get('src') + '?cache=' + new Date().toISOString();
}),
import Ember from 'ember';
export default Ember.Component.extend({
imageLoaded: 'image loading',
imageWidth: 'width loading',
// purely to make sure image loads each time and
// is not cached for testing
volatileSrc: Ember.computed('src', function(){
return this.get('src') + '?cache=' + new Date().toISOString();
@dwickern
dwickern / templates.application.hbs
Created October 4, 2016 22:10
positional params error // ember 2.9.0-beta.4
{{input foo bar}}
@dwickern
dwickern / components.blog-post.js
Created October 5, 2016 17:13
using "send" as an action name breaks things
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
send() { this.sendAction('send'); },
delete() { this.sendAction('delete'); }
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
/*openModal: function(modal, opts) {
this.controllerFor(modal).set('model', opts);
return this.render(modal, {
into: 'application',
outlet: 'modal'
});
},
@dwickern
dwickern / cancellable-promise.js
Created December 20, 2016 22:08
Ember cancellable promise
import Ember from 'ember';
export class CancellablePromise extends Ember.RSVP.Promise {
constructor(resolver, cancel, label) {
super(function (resolve, reject) {
try {
resolver(function resolved(value) {
cleanup();
resolve(value);
}, function rejected(reason) {
import Ember from 'ember';
const DEBOUNCE_MILLIS = 300;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
value: 1,
displayText: function() {