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
#!/usr/bin/env php | |
<?php | |
// Ewww a global variable! | |
$parsed_fixtures = array(); | |
function parse_fixture($table, $values) { | |
global $parsed_fixtures; | |
$parsed_fixtures[$table][] = $values; | |
} |
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
" Syntax highlighting on | |
syntax on | |
set t_Co=256 | |
colors zenburn | |
set go-=m " Hide menu | |
set go-=T " Hide toolbar | |
set nu! " Line numbers | |
set hidden " Hide buffers when switching rather than closing them |
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
$words = [ | |
'hello', | |
'there', | |
'yello', | |
'bob', | |
'tom', | |
'mabel', | |
'says', | |
'hi', | |
'secret', |
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
.session.vim |
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
man_pages = `manpath`.chomp.split(':').inject([]) do |memo, path| | |
memo += Dir[File.join(path, 'man*', '*')] | |
end.select { |path| path.match(/.*?\.[1-9]$/) } | |
exec "man #{man_pages[rand(man_pages.length)]}" |
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
WORDLIST = [ | |
"fuck", | |
"shit", | |
"cunt", | |
"wtf", | |
"wank", | |
"crap", | |
"hell", | |
"lame", | |
"rubbish", |
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 test_interspersity array | |
# Calculate the ideal average distance between elements by summing how many of | |
# each element exist and then dividing the length of the array by that number. | |
ideal_avg_distance = Hash.new(0) | |
array.each { |elem| ideal_avg_distance[elem] += 1 } | |
ideal_avg_distance.keys.each do |k| | |
ideal_avg_distance[k] = array.length.to_f / ideal_avg_distance[k] | |
end | |
# Gather up all of the indices that each element appears at. |
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
devrand = File.open("/dev/random", 'r') | |
valid = 0 | |
invalid = 0 | |
at_exit do | |
puts "\n\n\n\n#{valid}/#{valid + invalid}" | |
end | |
while chunk = devrand.read(64) |
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
# Ruby creates symbols at many different points in execution. Symbols occupy | |
# between 4 and 8 bytes in memory. Check using this code: | |
# | |
# #include <ruby/ruby.h> | |
# #include <stdio.h> | |
# | |
# int main(int argc, char* argv[]) { | |
# printf("%d\n", sizeof(ID)); | |
# return 0; | |
# } |
This file has been truncated, but you can view the full file.
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
INFO global: Vagrant version: 1.9.0 | |
INFO global: Ruby version: 2.2.5 | |
INFO global: RubyGems version: 2.4.5.1 | |
INFO global: VAGRANT_EXECUTABLE="C:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.9.0\\bin\\vagrant" | |
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="C:\\HashiCorp\\Vagrant\\embedded" | |
INFO global: VAGRANT_INSTALLER_ENV="1" | |
INFO global: VAGRANT_INSTALLER_VERSION="2" | |
INFO global: VAGRANT_LOG="debug" | |
INFO global: VAGRANT_OLD_ENV_ACLOCAL_PATH="C:\\Program Files\\Git\\mingw64\\share\\aclocal;C:\\Program Files\\Git\\usr\\share\\aclocal" | |
INFO global: VAGRANT_OLD_ENV_ALLUSERSPROFILE="C:\\ProgramData" |