Skip to content

Instantly share code, notes, and snippets.

View harryworld's full-sized avatar
🏠
Working from home

Harry Ng harryworld

🏠
Working from home
  • Hong Kong
View GitHub Profile
@harryworld
harryworld / sorting.md
Last active August 29, 2015 14:10
Sorting Algorithm

Sort the following sequence

[69,81,30,38,9,2,47,61,32,79]

Some common sorting algorithms

@harryworld
harryworld / json_api_quiz.md
Created November 12, 2014 21:43
JSON API Quiz

Here are the questions:

  1. How to keep my current changes, but also get the latest code from owner repository?

  2. How many routes do we have right now? (Hint: rake routes)

  3. What is the URL pattern for the routes?

  4. What do the status code 200, 201, 404, 500 mean?

@harryworld
harryworld / nested_resources.md
Last active August 29, 2015 14:08
Nested Resources

Nested Resources

class Post < ActiveRecord::Base
  has_many :comments
end
 
class Comment < ActiveRecord::Base
  belongs_to :post
end
@harryworld
harryworld / google_map.md
Created October 28, 2014 07:00
Add Google Map in Rails

Google Map for Rails

Gmaps4rails is developed to simply create a Google Map with overlays (markers, infowindows…).

Requirements

  1. Create an empty repository in GitHub, named googlemaps, select the READM, license, and rails .gitignroe file
  2. Clone the repository to local workspace folder
  3. cd googlemaps
  4. rails _4.1.6_ new . -BGT
  5. git add -A
@harryworld
harryworld / bdd.md
Last active August 29, 2015 14:08
BDD 5-min quiz
  1. What kinds of tests can we do in general?
User Acceptance Test
Integration Test
Unit Test
Stress Test
Profiling
@harryworld
harryworld / get_post.md
Created October 21, 2014 02:59
Using http methods in Rails
  • What method should I use?
<form action="/search" method="">
  <input type="text" name="p" value="">
  <input type="submit">
</form>
  • What method should I use?

Review for Phase 1

Node.js

  • Node Package Manager (npm)
  • http-server
  • CoffeeScript

jQuery

@harryworld
harryworld / array_function.md
Created October 1, 2014 03:15
Arrays and Functions
  1. Define a function that takes an array with numbers and prints all the elements of the array, separated by "--"
printSpecial([12, 33, 144, 122])
# 12 -- 33 -- 144 -- 122
  1. Define a function that takes an array with numbers and returns another array where each element contains double each element in the array
@harryworld
harryworld / for_quiz.md
Created September 29, 2014 08:43
Learn different languages
languages = ['CoffeeScript', 'JavaScript', 'Ruby', 'Python']

learn(languages)
Expected Result:

> CoffeeScript is CS