Skip to content

Instantly share code, notes, and snippets.

View raorao's full-sized avatar

Srinivas Rao-Mouw raorao

  • San Francisco, CA
View GitHub Profile
repository available at: https://github.com/raorao/ar-student-schema
For this challenge, I created a simple Students table using AR migration, populated a student object with basic methods and validations.
@raorao
raorao / progress.sass
Last active September 4, 2015 20:00
how I used to write sass --> how i write it now.
// how I used to write sass!
// -----------------------
// its short, sure, but short doesn't necessarily mean simple. Its very difficult for me
// to tell how a given element gets its styles -- element-1 is getting inherited styles
// from its container, and then has two different explicit selectors. At scale,
// its even harder to tell what overrides what, and file ordering begins to actually
// matter. Whenever I see code like this now, I refactor it asap -- before
// it gets too unwieldy and brittle to change.
.container-element
font: 15px verdana

Keybase proof

I hereby claim:

  • I am raorao on github.
  • I am raorao (https://keybase.io/raorao) on keybase.
  • I have a public key whose fingerprint is 2B05 C1E8 A751 C8FF DE93 20B6 CC2B F1A1 2EC2 F87E

To claim this, I am signing this object:

@raorao
raorao / foo.md
Last active August 29, 2015 14:18

bar foo

Query = {}
Query.new = function() {
var queryAttributes = {
filters: [],
beginDate: null,
endDate: null,
attribute: null
}
/ invalid
%div
%span
%span
%span{ |
"foo" => "bar", |
"baz" => 'quz' }
/ valid
%div
@raorao
raorao / witty_gem_name.rb
Created December 4, 2014 18:32
Google Docs ORM spec
# all permissions/setup are handled through the google docs interface. basically, this isn’t a DSL for google docs. figure that shit out yourself.
# all querying logic happens in ruby. find is provided for simplicity.
# no optimizing for speed. this is a google doc db after all.
# connections only occur when necessary. no preloading. avoid unncessary connections after first.
# configuration must be simple. and preferably self-contained within file.
#not tied to language. would be cool to do this as a front-end JS library too.
class User < APIModel
def self.configure
@SPREADSHEET_URL = ‘someurl’

PacMan!

Given a map, your program should find the shortest path between PacMan and Food.

The map is defined as a two-dimensional array, with the following key:

  • 'o' = open space
  • 'w' = wall
  • 'F' = food
  • 'P' = PacMan

BalanceValidator

The challenge is to write a function that evaluates whether an ordered list of edge characters — parentheses, brackets, or curly braces — is correctly balanced according to the following rules:

  1. Each opening character must be eventually followed by its corresponding closing character. (e.g. an opening parenthesis must be followed by a closing parenthesis, but not necessarily immediately.)

  2. The characters must be nested correctly, so that each pair of characters maintains a valid scope. (e.g. an opening bracket cannot be immediately followed by a closing curly brace.)

This challenge must be written in JavaScript. For ease of use, I suggest using node.

Sampler

The challenge is to implement a program called "sample" that outputs a sorted list of random numbers to the console. Your program should be run like this:

ruby sample MEMBERS LIMIT

MEMBERS is the number of results you want the program to output, and LIMIT is the upper limit for the sample range. All results should be greater than or equal to 0 and less than LIMIT. Some examples: