Skip to content

Instantly share code, notes, and snippets.

View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@krisselden
krisselden / index.hbs
Created Apr 25, 2014
sortable-list component example
View index.hbs
{{#each fruits}}
{{this}}
{{/each}}
{{draggable-list values=fruits}}
@krisselden
krisselden / test_helpers.js
Created Jun 6, 2014
pretender helper for qunit-bdd
View test_helpers.js
var pretender;
export function server(dsl) {
if (pretender) {
dsl.call(pretender);
return pretender;
}
pretender = new Pretender(dsl);
pretender.unhandledRequest = function (verb, path, request) {
fail("Pretender intercepted "+verb+" "+path+" but no handler was defined for this type of request");
throw new Error("Pretender intercepted "+verb+" "+path+" but no handler was defined for this type of request");
@krisselden
krisselden / broccoli-tee-tree.js
Last active Aug 29, 2015
Export a tree externally while passing it through.
View broccoli-tee-tree.js
var rimraf = require('rimraf');
var helpers = require('broccoli-kitchen-sink-helpers');
function TeeTree(inputTree, otherDir) {
this.inputTree = inputTree;
this.otherDir = otherDir;
}
TeeTree.prototype.read = function (readTree) {
var otherDir = this.otherDir;
View gist:447557b3235da375e1b6
#define WEAKIFY(x) __weak typeof(x)weak_##x = x
#define STRONGIFY(x) __strong typeof(weak_##x)x = weak_##x
MyViewController * __block myController = [[MyViewController alloc] init…];
// ...
WEAKIFY(myController);
myController.completionHandler = ^(NSInteger result) {
STRONGIFY(myController);
[myController dismissViewControllerAnimated:YES completion:nil];
};
View nsusernotification.c
#include <stdio.h>
#include <CoreFoundation/CoreFoundation.h>
#include <objc/runtime.h>
#include <objc/message.h>
#include <ruby.h>
#include <ruby/encoding.h>
static CFStringRef bundle_identifier = CFSTR("com.apple.finder");
@krisselden
krisselden / github_org_admin.rb
Created Mar 24, 2015
simple script to sync teams
View github_org_admin.rb
#!/usr/bin/env ruby
require 'io/console'
require 'net/https'
require 'json'
require 'yaml'
require 'set'
script_name = File.basename($0)
$config_file = File.join(Dir.home, ".#{script_name}rc")
View client.js
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost:3333/www.fnordware.com/superpng/pnggrad8rgb.jpg', true);
xhr.responseType = 'blob';
xhr.onload = function(e) {
var reader = new FileReader();
reader.onloadend = function() {
var img = document.createElement('img');
View watchman-reset.sh
#!/bin/sh
(for root in $(watchman watch-list | jq -r '.roots | .[]'); do watchman watch-del "$root" ; done)
View list-view-alternate.hbs
<div class='list-view-scrollable-content'>
{{#each pools key="type" as |pool|}}
{{#each pool key="key" as |item|}}
{{#component item.type content=item.content contentIndex=item.index style={{item.style}}}}
{{yield item.content item.index}}
{{/component}}
{{/each}}
{{/each}}
</div>
You can’t perform that action at this time.