Skip to content

Instantly share code, notes, and snippets.

tax_modifier = 0.015
tax = 0.6
after_tax = 400000.0
while tax >= 0 do
if after_tax > 35000.0
income = after_tax / (1.0 - tax)
else
@dcki
dcki / wedding_music.md
Last active August 29, 2015 14:02
Wedding music

Before the ceremony:

Please play these so that the last one ends as close to the beginning of the ceremony as possible. Please play them in order and especially play the last 3. Please don't play anything between Watch Them Grow and the beginning of the ceremony.

This list is 31:42 long.

01 Beethoven Piano Sonata #18 In E.mp3

02 Art Of Motion.mp3

class Node
attr_accessor :children
def initialize
@children = []
end
def to_s
"Node with children #{children.to_s}"
end
end
@dcki
dcki / gist:2fee45ccffaa6992d59d
Last active August 29, 2015 14:01
JavaScript and text encodings
After much consideration (well, a few hours), I've decided that this is all you really need to
know about how JavaScript deals with unicode, utf-8, and utf-16:
1. Suppose you have a unicode character that you want to put in a string in
JavaScript code.
a. One way to do that is to copy the character from wikipedia, for
example, and paste it into your code.
b. The other way is to encode the character's codepoint in utf-16
@dcki
dcki / gist:6e52f4c1d8fe789e0a87
Last active August 29, 2015 14:01
JavaScript Constructor.prototype.method saves memory
'use strict';
// 56 MB in Chrome using JavaScript Console > Profiles > Take Heap Snapshot.
// 117 MB in Firefox viewing the URL about:memory.
function A() {
this.b = function() {
alert('yo');
};
}
var a = [];
@dcki
dcki / gist:8465517
Created January 16, 2014 23:27
Error running dummy app generator because of missing mysql lib
foos david$ bundle exec rake refinery:testing:dummy_app
rake aborted!
dlopen(/Users/david/.rvm/gems/ruby-1.9.3-p448@refinery-test/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/david/.rvm/gems/ruby-1.9.3-p448@refinery-test/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/david/.rvm/gems/ruby-1.9.3-p448@refinery-test/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle
/Users/david/.rvm/gems/ruby-1.9.3-p448@refinery-test/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
/Users/david/.rvm/gems/ruby-1.9.3-p448@refinery-test/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `block in require'
/Users/david/.rvm/gems/ruby-1.9.3-p448@refinery-test/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/david/.rvm/gems/ruby-1.9.3-p448@refinery-test/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
/Users/david/.rvm/g
@dcki
dcki / gist:8425125
Created January 14, 2014 20:31
database.yml from engine test dummy app test_app/vendor/extensions/things/spec/dummy/config/database.yml
login: &login
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *login
database: dummy_dev
@dcki
dcki / gist:8425080
Last active January 3, 2016 06:49
Output of rspec testing on refinerycms engine with dummy app test_app/vendor/extensions/things
things david$ bundle exec rake spec
/Users/david/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -S rspec ./spec
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
FFFFFFFFF
Failures:
@dcki
dcki / gist:7961780
Last active December 31, 2015 08:39
Bunny engine.rb
module Refinery
module Bunny
class Engine < Rails::Engine
extend Refinery::Engine
isolate_namespace Refinery::Bunny
engine_name :refinery_bunny
initializer "register refinerycms_bunny plugin" do