This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fn = 100; | |
ballDiameter = 4.4; | |
ropeDiameter = 7.5; | |
numBalls = 12; | |
circumference = numBalls * (ballDiameter + ropeDiameter); | |
diameter = circumference / PI; | |
ballRadius = ballDiameter / 2; | |
outerHeight = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# how | |
curl -i -X PUT -d '{"answer":"<answer_goes_here>"}' http://minisculus.edendevelopment.co.uk/<question_id_here> | |
# e.g. | |
curl -i -X PUT -d '{"answer":"incorrect"}' http://minisculus.edendevelopment.co.uk/14f7ca5f6ff1a5afb9032aa5e533ad95 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should result in '13' when given a '11'" do | |
machine.encode( "11" ).should == "13" | |
end | |
it "should result in '147' when given a '123'" do | |
machine.encode( "123" ).should == "147" | |
end | |
it "should result in '147A' when given a '1234'" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# history | |
HISTFILE=~/.zsh_history | |
HISTSIZE=5000 | |
SAVEHIST=1000 | |
# shared history between sessions | |
setopt share_history | |
# ignore dupes in history | |
setopt hist_ignore_dups | |
# settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Save this all as a file somewhere, open in Vim | |
# 2. Move the cursor to inside the string below, and cast this spell (followed by <CR>): "ayiW@a | |
13jf3viw,recTHREE | |
class AboutArrays < EdgeCase::Koan | |
def test_creating_arrays | |
empty_array = Array.new | |
assert_equal Array, empty_array.class | |
assert_equal 0, empty_array.size | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> create table wtf ( id int not null auto_increment primary key, expletive varchar(64) not null, incredulity_level int not null, nullable int null ); | |
Query OK, 0 rows affected (0.01 sec) | |
mysql> show create table wtf; | |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
| Table | Create Table | | |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
| wtf | CRE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def counter(start=0, increment=1) | |
total = start - increment | |
lambda do | |
total += increment | |
end | |
end | |
result = counter(10,2) | |
puts result.call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppServer | |
attr_accessor :admin_password, :port | |
end | |
class Configuration | |
attr_accessor :tail_logs, :max_connections, :admin_password | |
def app_server | |
if block_given? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugins | |
Definitely take a look at pathogen, it's pretty straightforward to setup. Once installed you can | |
keep each plugin in its own dir (and use git submodules to keep 'em up to date/auto-install etc) | |
https://github.com/tpope/vim-pathogen | |
.vimrc | |
Few things you may want to look into, ':h options' to look at what 'set'tings do. Most of the below I use a *lot* :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this doesn't work | |
find . -type f -iname '*rhtml' -exec echo git mv {} `echo {} | sed 's/rhtml$/html.erb/i'` \; | |
# output | |
.. | |
git mv ./pictures/_form.rhtml ./pictures/_form.rhtml | |
.. | |
# but this works | |
find . -type f -iname '*rhtml' | while read i; do echo git mv $i `echo $i | sed 's/rhtml$/html.erb/i'`; done |
OlderNewer