Skip to content

Instantly share code, notes, and snippets.

View zaius's full-sized avatar

David Kelso zaius

  • Beyond Pricing
  • San Francisco
View GitHub Profile
@zaius
zaius / runner.js.coffee
Created March 10, 2014 05:21
Broccoli runner
fs = require 'fs'
util = require 'util'
{spawn} = require 'child_process'
steps = []
# NOTE: can't use console to output as it's buffered.
log = (args...) ->
out = process.stdout.write args.join(' ') + '\n'
@zaius
zaius / rage.txt
Created April 19, 2014 02:39
ruby and newlines
zaius@pro:~$ irb
irb(main):001:0> (2 +
irb(main):002:1* 3)
=> 5
irb(main):003:0> (2
irb(main):004:1> +3)
=> 3
@zaius
zaius / deep.js.coffee
Created April 28, 2014 08:40
Deep hard link / copy
fs = require 'fs'
path = require 'path'
RSVP = require 'rsvp'
rimraf = require 'rimraf'
mkdirp = require 'mkdirp'
walkSync = require 'walk-sync'
# Passing in a srcDir allow us to know where the path should be relative to.
# This means we can autocreate subdirectories for all files.
exports.linkFiles = (files, srcDir, destDir) ->
@zaius
zaius / keybase.md
Created July 2, 2014 04:22
Keybase

Keybase proof

I hereby claim:

  • I am zaius on github.
  • I am davidkelso (https://keybase.io/davidkelso) on keybase.
  • I have a public key whose fingerprint is 2B2C 209F BCC0 BF21 4234 7292 7427 8BD5 9B48 8C48

To claim this, I am signing this object:

@zaius
zaius / var is weird.js
Created December 10, 2014 01:41
Javascript var
var foo = 1;
var bar = 1;
(function() {
console.log(foo, bar)
var bar = 2
foo = 2
console.log(foo, bar)
})()
import Ember from 'ember';
const {computed} = Ember;
export default Ember.Component.extend({
tagName: 'a',
_setupDropdown: Ember.on('didInsertElement', function() {
this._super.apply(this, arguments);
Ember.run.scheduleOnce('afterRender', this, function() {
class User < Sequel::Model
one_to_many :posts
def tags_dataset
posts.join(Tag, :post_id => :id)
end
def tags
tags_dataset.all
end
end
numbers = 3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81, 92, 95, 97, 99
set_count = 0
numbers.each_with_index do |number, i|
numbers.combination(i).each do |combination|
set_count += 1 and puts combination.inspect if combination[0..-2].sum == combination[-1]
end
end
s = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedea
@zaius
zaius / flashblock.html
Created October 26, 2010 03:20
Inconsistent problem with flashblock and swfobject
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
swfobject.registerObject("swfobject_static", "9.0.115", "expressInstall.swf");
</script>
</head>