The Go standard library does not have nullable values for basic types like strings and integers, which can be confusing for someone coming from weak or dynamically typed languages like Ruby, Python, or JavaScript. Here's a comparison of how Ruby sets variable defaults compared to Go:
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
#------------------------------------------------------------------ | |
# | |
# Bayes Optimal Classifier | |
# | |
# In this quiz we will compute the optimal label for a second missing word in a row | |
# based on the possible words that could be in the first blank | |
# | |
# Finish the procedurce, LaterWords(), below | |
# |
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
$modal = $("<div><ul></ul></div>") | |
$modal.css({ | |
position: "absolute", | |
height: "500px", | |
width: "500px", | |
background: "white", | |
border: "1px solid gray", | |
padding: "10%", | |
margin: "5% 25%" | |
}); |
A few of you have been having a lot of trouble with the "Laptop" script that's supposed to install a bunch of tools for you and I apologize for that, there are actually only 2 main tools that you need to have installed. If you haven't already done the developer setup yet, please follow these updated instructions instead:
Note: We'll be checking version numbers to make sure things were installed correctly, it's completely OK if your version number is not exactly the same as the ones I've given as examples below.
If you're not on OS X Lion, you will need to upgrade to it. I should have mentioned that as an up front prerequisite, so if you do need to upgrade please let me know and I'll refund you $30 to cover the cost of the upgrade.
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
namespace :db do | |
namespace :migrate do | |
desc "create an empty timestamped migration file" | |
task :new do | |
raise "Usage: rake db:migrate:new NAME='create_cohorts'" if ENV["NAME"].nil? | |
current_migration = Dir.glob("./db/migrate/[0-9]*_*.rb").collect do |file| | |
File.basename(file).split("_").first.to_i | |
end.max.to_i |
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 "Bookmarks" do | |
describe "GET /bookmarks" do | |
context "when user is not logged in" do | |
it "should redirect a to home" do | |
get bookmarks_path | |
response.should redirect_to(root_url) | |
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
# This file will be copied to ~/.emscripten if that file doesn't exist. Or, this is that copy. | |
# IMPORTANT: Edit the *copy* with the right paths! | |
EMSCRIPTEN_ROOT = os.path.expanduser('~/Dev/emscripten') # this helps projects using emscripten find it | |
LLVM_ROOT = os.path.expanduser('/usr/local/Cellar/llvm/3.0/bin') | |
# See below for notes on which JS engine(s) you need | |
NODE_JS = 'node' | |
SPIDERMONKEY_ENGINE = [os.path.expanduser('~/Dev/mozilla-central/js/src/js'), '-m', '-n'] |
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
!!! 5 | |
%html | |
%head | |
%title welcome visitor | |
%body | |
%h1 hello there |
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 'sinatra' | |
configure do | |
require 'redis' | |
require 'uri' | |
REDISTOGO_URL = ENV["REDISTOGO_URL"] | |
uri = URI.parse(REDISTOGO_URL) | |
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) | |
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
(master)⚡ % rake assets:precompile --trace ~/code/Bieber | |
** Invoke assets:precompile (first_time) | |
** Execute assets:precompile | |
/Users/roshan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/roshan/.rvm/gems/ruby-1.9.2-p290@holla/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace | |
** Invoke assets:precompile:all (first_time) | |
** Execute assets:precompile:all | |
** Invoke assets:precompile:primary (first_time) | |
** Invoke assets:environment (first_time) | |
** Execute assets:environment | |
** Invoke tmp:cache:clear (first_time) |
NewerOlder