Skip to content

Instantly share code, notes, and snippets.

View FifthSurprise's full-sized avatar

Kevin Chang FifthSurprise

View GitHub Profile
Name: Kevin Chang
Github: http://github.com/FifthSurprise
Blog: fifthsurprise.wordpress.com
Tagline: "Make nifty things"
Profile Picture: http://imgur.com/LlwHAbL
Treehouse Account: http://teamtreehouse.com/fifthsurprise
CoderWall Account: https://coderwall.com/fifthsurprise
CodeSchool Account: http://www.codeschool.com/users/fifthsurprise
Favorite Websites:
@FifthSurprise
FifthSurprise / gist:9405443
Created March 7, 2014 04:53
Def initialize
<snippet>
<content><![CDATA[def initialize
$0
end]]></content>
<!-- Optional: File should go into: ~/Library/Application Support/Sublime Text 2/Packages/Ruby -->
<tabTrigger>defi</tabTrigger>
<scope>source.ruby</scope>
<description>def initialize .. end</description>
</snippet>
@FifthSurprise
FifthSurprise / gist:9413242
Created March 7, 2014 15:13
Euler3 and Euler4
def euler3
num=600851475143
n=num
if n % 2 ==0
lastFactor = 2
n = n/2
while n%2==0
n = n/2
end
else
~~Big O
~~Question:
Depth First Search (DFS)
~Answer:
Graph of |V| vertices and |E| edges
Average Time Complexity: -
Worst Time Complexity: (Good) O(|E| + |V|)
Worst Space Complexity: O(|V|)
~~Hipster Ipsum
~~Question:
Street art fap roof party Intelligentsia mustache keytar church-key Shoreditch Marfa
~Answer:
Meggings shabby chic pug, chia Etsy street art Godard High Life direct trade
~~Question:
Put a bird on it banjo DIY, trust fund viral yr meh ennui Marfa
~Answer:
Bicycle rights chambray before they sold out High Life Banksy
~~Question:
~~Pokemon
~~Question:
Bulbasaur
~Answer:
![Bulbasaur](http://Bulbasaur.jpg.to)
~~Question:
Ivysaur
~~Flatiron Students
~~Question:
Guess the student.
![Justin Belmont](http://students.flatironschool.com/img/students/justinbelmont_profile.jpg)
~Answer:
Justin Belmont
~~Question:
Guess the student.
![Morgan Evans](http://students.flatironschool.com/img/students/M.Evans.school.square.jpg)
@FifthSurprise
FifthSurprise / gist:9954300
Created April 3, 2014 13:27
Javascript Autocomplete sample
function updateSearchValues() {
function collect(arr, value) {
var results = [];
for (var i = 0; i < arr.length; i++) {
results.push(arr[i][value]);
}
return results;
};
var booksearch = $("#booksearch");
//Only request if 3 or more characters entered into search
@FifthSurprise
FifthSurprise / flatironretrospectives
Last active August 29, 2015 14:00
Flatiron Retrospectives
* You can run multiple instances of rails server by changing the port number: rails s -p 3001
* For learning CSS stuff - http://flukeout.github.io/
* Assume the following tables: A table of users, and a table of books.
** Outer left join is used for in the following scenario: If you had users who may have books, an outer left join would allow you to get all the users and their books, if they have them.
** Inner join would get all of the users even if they have no books and all of the books even if they have no users.
** Full outer join would be all of the users and all of the books whether they have an associated book or user.
* When :js => true when using Caybara and Javascript, you need to make sure the database is truncation instead of transaction since a separate thread is spun off during testing.
* Ruby Trivia: https://github.com/gregstallings/ruby-trivia
@FifthSurprise
FifthSurprise / gist:681b8ab50afb908431a2
Created April 30, 2014 00:40
Ruby Trivia - Gregstallings
~~Ruby Trivia
~~Question:
What is the highest level in the object model?
~Answer:
`BasicObject`
~~Question:
Is everything in Ruby an object?