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 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
# For one, it's just nicer to look at. | |
# No more excessive brackets and semi colons | |
## js | |
function foo(bar){ | |
if (bar == 0){ | |
return "zero!"; | |
} else { | |
return "Not zero!"; | |
} |
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
# I have no idea what I'm doing. | |
require 'java' | |
Dir["sigar/*.jar"].each { |jar| require jar } | |
# import sigar class | |
# Must be java 1.7 | |
import_sigar = org.hyperic.sigar | |
sigar = import_sigar.Sigar.new | |
shell = import_sigar.cmd.Shell.new |
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
require 'rubygems' | |
require 'mongo' | |
@conn = Mongo::Connection.new | |
@db = @conn['trails'] | |
@collection = @db['bikeways'] | |
puts @collection.find('properties.FCODE' => 203001).to_a | |
# BOOM |
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
public class Ackermann { | |
public static int ack(int m, int n){ | |
if (m == 0){ | |
return n + 1; | |
} | |
if (n == 0){ | |
return ack(m - 1, 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
# Make sure ant is installed and available on the machine | |
require 'ant' | |
ant :name => 'hello', :default => 'hello' do | |
target :name => 'hello' do | |
echo :message => 'Hello world!' | |
end | |
end | |
# $ jruby build.rb | |
# > hello: |
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
require 'java' | |
Dir["vendor/sigar/*.jar"].each { |jar| require jar } |
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
# General things | |
sudo apt-get update | |
sudo apt-get install build-essential zlib1g-dev curl wget git-core postgresql mongodb | |
# install rbenv and Ruby 1.9.3 | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile | |
echo 'eval "$(rbenv init -)"' >> ~/.profile | |
source .profile |
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 SampleClass | |
def initialize | |
@str = "The Quick Brown Fox" | |
end | |
def get_binding | |
binding | |
end | |
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
require 'spec_helper' | |
describe User do | |
describe "#initialize" | |
context 'with all parameters' do | |
it "works" do | |
user = User.new :first_name => "slkdfjlaskdf" | |
user.first_name.should == "" | |
user.last_name.should == "" | |
end |
OlderNewer