Skip to content

Instantly share code, notes, and snippets.

View spacemonkeyvt's full-sized avatar

Vishal Tiwari spacemonkeyvt

View GitHub Profile
@spacemonkeyvt
spacemonkeyvt / http.md
Created August 8, 2016 15:00 — forked from FaisalAl-Tameemi/http.md
Intro To HTTP Notes

Introduction to HTTP

Starting from the top...

Classical Inheritance in Ruby

For programmers who are new to Object Oriented Programming, the ideas behind classical inheritance can take some getting used to. This article walks you through the syntax of defining class inheritance in Ruby with explanations of each OOP feature along the way. You will have created many inheriting classes and used them in Ruby code by the end of this exercise.

Create a new Ruby code file and copy the code examples into it as you go. Run the file with the provided driver code and read the output. Try writing your own driver code to try things out new concepts as they're introduced.

@spacemonkeyvt
spacemonkeyvt / sort.rb
Created July 19, 2016 21:47 — forked from aspyct/sort.rb
Sample implementation of quicksort, mergesort and binary search in ruby
# Sample implementation of quicksort and mergesort in ruby
# Both algorithm sort in O(n * lg(n)) time
# Quicksort works inplace, where mergesort works in a new array
def quicksort(array, from=0, to=nil)
if to == nil
# Sort the whole array, by default
to = array.count - 1
end
> nest = [1,2,3, {name: "Vish", address: ["123 fake add", "456 fake add", city: ["toronto", "north york"]]}, ["thingy", "thingy2"]]
#=> [1, 2, 3, {:name=>"Vish", :address=>["123 fake add", "456 fake add", {:city=>["toronto", "north york"]}]}, ["thingy", "thingy2"]]
> nest[3]
#=> {:name=>"Vish", :address=>["123 fake add", "456 fake add", {:city=>["toronto", "north york"]}]}
> nest[3][:address]
#=> ["123 fake add", "456 fake add", {:city=>["toronto", "north york"]}]
> nest[3][:address][2]
@spacemonkeyvt
spacemonkeyvt / unix_command_discovery.md
Last active July 18, 2016 18:10
UNIX Command (Discovery) - This exercise should help you become familiar with your UNIX command prompt.

Unix Commands - Discovery

Part I

Enter these commands individually on the UNIX prompt (in your vagrant ssh session). Try to interpret the output. Research their purpose on google as needed, and don't be afraid to experiment.

  • pwd
  • cd ~/
  • ls -al
  • echo hello world
  • date
@spacemonkeyvt
spacemonkeyvt / The Technical Interview Cheat Sheet.md
Created July 18, 2016 01:54 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@spacemonkeyvt
spacemonkeyvt / sql_examples.txt
Last active July 7, 2016 21:29
INTRO TO SQL - CRUD cheat sheet from lecture
CREATE///////////////////////////
CREATE TABLE student (id INTEGER PRIMARY KEY, first_name TEXT, last_name TEXT, age INT);
.tables /* Shows the table created */
.schema /* Shows the schema used to create the table */
SELECT * FROM student; /* Show all rows in the student table */
@spacemonkeyvt
spacemonkeyvt / ActiveRecord Cheat Sheet v1
Created July 7, 2016 20:55 — forked from jessieay/ActiveRecord Cheat Sheet v1
Active Record cheat sheet with examples of queries I've needed most so far
ActiveRecord cheat sheet / EXAMPLES
INSTALL
=======
$ gem install activerecord
in GEMFILE: gem ‘activerecord’
REQUIRE
=======
require ‘active_record’