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
function scrollTo(id) { | |
$('html,body').animate({scrollTop: $("#" + id).offset().top}, 'slow'); | |
} |
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
source 'http://rubygems.org' | |
gem "rake", "~> 0.9.2.2" | |
gem "uglifier", "~> 1.2.6" | |
gem "listen", "~> 0.4.7" |
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
@fadeWith = (sound, duration) -> | |
return @ if !supported | |
@fadeOut duration, -> | |
@stop() | |
sound.play().fadeIn(duration) | |
return @ |
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
static int | |
list_remove(node* root, node* n) { | |
node* temp = (node*) malloc(sizeof(node)); | |
temp = root; | |
node* garbage = (node*) malloc(sizeof(node)); | |
int found = -1; | |
while (temp) { | |
if (temp->next->val == n->val) { | |
garbage = temp->next; |
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 sumDouble(ary); ary.map{|i| i*2}.inject(&:+); 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 "test/unit" | |
# Write a function called numPizzas, that takes the number of people present, | |
# the number of slices in a pizza, and the time of day, and returns the | |
# number of pizzas to buy (as a whole integer). | |
# | |
# Spec: | |
# Signature: int numPizzas(int numPeople, int slicesPerPizza, int time) | |
# Time is an int on 24-hour clock (0-23), e.g. 8 = 8am, 14 = 2pm | |
# Between 11am - 11pm: 2 slices per person, else 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
// hashtable.hpp | |
class HashTable { | |
public: | |
struct HashTable::HashEntry* insert(int); | |
struct HashEntry { | |
// Some stuff | |
}; | |
}; |
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
# Print the numbers from 1 to 100, except for multiples of 3 print "Fizz", for multiples of 5 print "Buzz", | |
# and for multiples of 3 and 5 print "FizzBuzz". | |
# Ex: | |
# 1 | |
# 2 | |
# Fizz | |
# 4 | |
# Buzz | |
# Fizz | |
# 7 |
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
# Test cases used | |
# | |
# DOWN LEFT | |
# 3 | |
# --- | |
# -m- | |
# p-- | |
# UP RIGHT | |
# 3 |
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
Brainfuck (http://en.wikipedia.org/wiki/Brainfuck) is an strange language noted for its extreme simplicity - programs are written using 7 commands in total, and executed sequentially. | |
An 'instruction pointer' starts at the first command, executes it, and normally moves forward to the next command (with one exception). | |
The program terminates when the instruction pointer moves past the last command. | |
For those familiar with Turing machines, this is a very similar concept. We'll have a 'tape' of cells holding our values, a pointer to the current cell, and an instruction pointer looping through the program. | |
The commands we'll be working with are as follows (here, 'pointer' refers to the current cell pointer): | |
> Move the cell pointer to the cell on the right | |
< Move the cell pointer to the cell on the left |
OlderNewer