So you think you wanna be a web developer... Fork this, update your copy with answers. They don't need to be precise - pseudo-code is fine in most cases. Some questions don't have correct answers.
This file contains hidden or 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 Dynamical | |
define_method :works_fine do |&block| | |
5.times { |n| block.call(n) } | |
end | |
def self.defn name | |
define_method name do |&block| | |
5.times { |n| yield n } | |
end | |
end |
This file contains hidden or 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
$ rake gem | |
rm -rf build/bootstrap | |
mkdir -p build/bootstrap | |
Compiling 10 source files to /Users/nick/hacking/mirah_hacking/mirah/build/bootstrap | |
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/IsolatedResourceLoader.java | |
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/MirahClassLoader.java | |
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/compiler/Cleaned.java | |
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/Flags.java | |
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/MemberAccess.java | |
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/MemberKind.java |
This file contains hidden or 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
function silencing_stderr() { | |
$* 2>/dev/null | |
} | |
function branch_names() { | |
git br | awk '{print $1}' | grep -v '*' | xargs | |
} | |
function most_recent_commit() { | |
git log . | grep "Date: " | cut -c 9- | head -1 |
This file contains hidden or 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
function silencing_stderr() { | |
$* 2>/dev/null | |
} | |
function branch_names() { | |
git br | awk '{print $1}' | grep -v '*' | xargs | |
} | |
for branch_name in $(branch_names) | |
do |
This file contains hidden or 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
libs = ARGV.size == 0 ? all_gems : ARGV | |
list = | |
libs. | |
forkify(16){|lib| puts "#{ lib }..."; [lib, polluted_by(lib)]}. | |
sort_by{|pair| pair.last} | |
list.each do |lib, polluted| | |
puts "polluted_by('#{ lib }') #=> #{ polluted }" |
This file contains hidden or 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
# USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
# | |
# - fixes handling of <text> elements | |
# - prepends namespaces on keys where used including both elements & attributes | |
# - uses strings instead of symbols to prevent consumption of the symbol table | |
require 'nokogiri' | |
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
class Nokogiri::XML::Node | |
def namespaced_name |
This file contains hidden or 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
~/hacking/fresh_mirah]$ bundle exec mirahc -V test.mirah | |
Parsing... | |
test.mirah | |
Inferring types... | |
* [Mirah::Typer] New type defined: 'Test' < '' | |
* [Mirah::Typer] Learned local type under #<Mirah::AST::StaticScope:0x39e2ee3f> : test = Type(boolean) | |
* [AST] [RequiredArgument] RequiredArgument(test) resolved! | |
... |
This file contains hidden or 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
6: Cannot find instance method set(int, int) on java.util.List | |
Mirah::InternalCompilerError: Cannot find instance method set(int, int) on java.util.List | |
infer at ~/hacking/fresh_mirah/lib/mirah/typer/simple.rb:280 | |
infer at ~/hacking/fresh_mirah/lib/mirah/ast/structure.rb:34 | |
each at org/jruby/RubyArray.java:1603 | |
infer at ~/hacking/fresh_mirah/lib/mirah/ast/structure.rb:33 | |
infer at ~/hacking/fresh_mirah/lib/mirah/typer/simple.rb:275 | |
infer at ~/hacking/fresh_mirah/lib/mirah/ast/flow.rb:125 | |
collect at org/jruby/RubyArray.java:2336 |
This file contains hidden or 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
require 'rubygems' | |
require 'kingdom-assignment' | |
if CSV.const_defined? :Reader | |
# require 'fastercsv' | |
INSTALLED_CSV = FasterCSV | |
else | |
INSTALLED_CSV = CSV | |
end |
NewerOlder