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 CreateBookmarksAndUsers < ActiveRecord::Migration | |
def self.up | |
create_table :users do |t| | |
t.string :username | |
t.string :password | |
t.string :email_address | |
t.timestamps | |
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
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char **argv) | |
{ | |
printf("i have %i args\n",argc); | |
int i; | |
for (i = 0; i < argc; i++) { | |
if (i != argc - 1) | |
memset(argv[i] + strlen(argv[i]), ' ', 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
/* | |
* | |
* Your tasks are to: | |
* - Create a data representation for the cards (this may require some form of | |
* data structure and suitable constant definitions). | |
* - Create a data representation to keep track of the positions of the cards in | |
* the deck. | |
* - Implement procedures for cutting and shuffling the deck. Each operation | |
* (cut and merge) should include a random perturbation: | |
* - The initial cut might deviate from a perfect cut in half by, say, one to |
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
(defn pfilter [pred coll] | |
"perform filter in parallel" | |
(map second | |
(filter first | |
(pmap (fn [item] [(pred item) item]) coll) | |
) | |
) | |
) | |
(defn is-divisible [x y] |
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 "inline" | |
class Time | |
inline(:C) do |builder| | |
# c_singleton creates class method | |
builder.c_singleton "long epoch_sec() { return time(NULL); }" | |
end | |
end | |
require 'benchmark' |
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
// Java sorts numbers before letters, so if one is a letter and one is a number, | |
// flip their sort ordering | |
if (Character.isDigit(ourName.charAt(0)) ^ Character.isDigit(theirName.charAt(0))) | |
return ourName.compareTo(theirName) * -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
5.times.each do |i| | |
puts i | |
next | |
puts "please don't see this" | |
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
// fast-fail boolean checking makes me do horrible things | |
var valid = true; | |
valid = validate_username(form.txtUsername) && valid; | |
valid = validate_email(form.txtEmail) && valid; | |
valid = validate_phone(form.txtPhone) && valid; | |
valid = validate_address(form.txtAddress) && valid; | |
valid = validate_city(form.txtCity) && valid; | |
valid = validate_state(form.optState) && valid; | |
valid = validate_zip(form.txtZip) && valid; | |
valid = validate_gender(form.radGender) && valid; |
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
#! /bin/bash | |
git checkout -b $1 && mv $3 /tmp/superdiffr1-$3 | |
git checkout -b $2 && mv $3 /tmp/supprdiffr2-$3 | |
git checkout HEAD | |
opendiff /tmp/superdiffr1-$3 /tmp/supprdiffr2-$3 |
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
/* read signed bit */ | |
/* flush = YES to clear remaining bits */ | |
uint8 readSB(FILE *file, BOOL flush) | |
{ | |
static uint8 bits = 0; | |
static uint8 bitpos = 8; | |
if (bitpos > 7) { | |
bits = readUI8(file); | |
bitpos = 0; |