Skip to content

Instantly share code, notes, and snippets.

View iamwilhelm's full-sized avatar

Wil Chung iamwilhelm

  • Mountain View, CA
View GitHub Profile
<a href="javascript:get();">Get comments</a>
/* This sample uses jQuery */
/* This doesn't work.
*
* Here, notice the success callback uses the data variable, except when called,
* the anonymous function can't access the data variable, since it's defined within
* the scope of the anonymous object that's sent to the request() method.
*/
function someEvent(event) {
var data = { 'update-success' : "result_list", 'update-failure' : "error_list" };
1 times:
"Hello world!\n" print
.
1 times:
about("_why") print
about("stage fright") print
.
["Two", "Birds", "In", "Hand"].each_with_index.map { |element, index|
"#{element}: #{index}"
}
# => ["Two: 0", "Birds: 1", "In: 2", "Hand: 3"]
@iamwilhelm
iamwilhelm / ruby_quiz_001.rb
Created December 23, 2009 09:06
A solution to rubyquiz #1. Took about 3 hours
#!/usr/bin/ruby
class Encrypter
private
def value(symbol)
return 53 if symbol == "A" or symbol == "B"
return symbol.to_i
end
def triple_cut
<!-- Changes this into a div placeholder -->
<img class="lorem" data-size="200x100" />
-module(guess).
-export([start/0]).
start() ->
intro(6).
intro(Guesses) ->
io:format("Welcome to the Guessing game!\n"),
io:format("I'm thinking of a number between 1 and 20\n"),
get_guess(Guesses, random:uniform(20)).
<!-- When you want to set the color -->
<img class="lorem" data-size="100x100" data-color="#ddd" />
<!-- Or when you want some other styles along with it -->
<img class="lorem" data-size="100x100" style="margin: 10px" />
<!-- Or if you want to override something -->
<img class="lorem" data-size="100x100" style="border: 0px solid black" />
bash-3.2$ for f in *.html; do mv $f `basename $f .html`.erb ; done