Skip to content

Instantly share code, notes, and snippets.

View sharnie's full-sized avatar

Sharnie Ivery sharnie

View GitHub Profile
@sharnie
sharnie / to_roman.js
Created May 27, 2014 14:57
Convert numbers to Roman Numerals using JavaScript
var toRoman = function(num){
var range, numerals, roman_numeral, i;
range = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
numerals = "M CM D CD C XC L XL X IX V IV I".split(" ");
roman_numeral = "";
for(i=0;i<range.length;i++){
while(num >= range[i]){
num -= range[i];
# Substitute Postgres.app/Contents/Versions/9.3 with appropriate version number
sudo ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.5/bin/pg_config
name = "Sharnie Ivery"
<<-GREET
Hello, #{name}
GREET
# => "Hello, Sharnie Ivery"
name = "Sharnie Ivery"
<<-'GREET'
Hello, #{name}
GREET
# => "Hello, #{name}"
name = "Sharnie Ivery"
<<-`GREET`
hostname
whoami
GREET
# => "sharnieivery"
Sublime Text 2 - Useful Shortcuts
=================================
*Tested in Mac OS X: super == command*
Open/Goto
_________
- super+t: go to file
- super+ctrl+p: go to project
- super+r: go to methods

Interview Prep

General Thoughts for Interviewing

Three Primary Responsibilities

  • Build.
  • Blog.
  • Bresent.

Problem Solving

"Make it work, make it right, make it fast."

for(var i = 1; i <= 20; i++) {
if( i % 3 === 0 && i % 5 === 0 ) {
console.log( "FizzBuzz" );
} else if( i % 3 === 0 ) {
console.log( "Fizz" );
} else if( i % 5 === 0 ) {
console.log( "Buzz" );
@sharnie
sharnie / gist:9486321519c39574305c
Created December 9, 2014 23:11
Center/Middle Div
#outer {
width: 100%;
text-align: center;
}
#inner {
display: inline-block;
}
class SearchController < ApplicationController
def index
access_token = "YOUR ACCESS TOKEN HERE" # should have been session[:access_token]. Never store credentials in your code
client = Instagram.client(access_token: access_token)
geocoder = Geocoder.search(params[:q] || "brooklyn, new york")
lat = geocoder.first.data["geometry"]["location"]["lat"]
lng = geocoder.first.data["geometry"]["location"]["lng"]
@results = client.location_search(lat, lng)
end
end