Skip to content

Instantly share code, notes, and snippets.

View jzntam's full-sized avatar

Jason Tam jzntam

View GitHub Profile
@jzntam
jzntam / tab icon.md
Last active August 29, 2015 14:10
Adding icons or images to browser tabs

How to add an icon to the browser tab

Reference: http://en.wikipedia.org/wiki/Favicon

  1. Called a favicon or just simply icon. Solid or transparent image

  2. Convert a transparent image to an ico file. (not necessary)

  • use PhotoShop
  • find a conversion site online, google "favicon generator"
@jzntam
jzntam / linebehind.md
Last active August 29, 2015 14:11
HTML - Line Behind Text

Inside the <h1> tags wrap the title text with a span

<h1>
  <span>TITLE</span>
</h1>

Add the following to the css file.

@jzntam
jzntam / vertcent.md
Last active August 29, 2015 14:13
Brent's Vert Center
.some-thing {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

or

@jzntam
jzntam / 0_reuse_code.js
Created December 28, 2015 23:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jzntam
jzntam / Brent's Git Aliases
Last active December 28, 2015 23:59
Git Aliases used by Brent
alias gs="git status"
alias gbr="git for-each-ref --sort=-committerdate refs/heads/"
alias ga="git add"
alias gaa="git add -A"
alias gc="git commit"
alias gci="git ci"
alias gph="git push origin HEAD"
alias gphk="git push heroku master"
alias gdc="git diff --cached"
alias gd="git diff"
@jzntam
jzntam / scroll.md
Last active December 28, 2015 23:59
How to use parallax

Fisher-Yates Knuth Method

function shuffle(array) {
  var currentIndex = array.length, temporaryValue, randomIndex ;

  // While elements are avaiable to shuffle
  while (0 !== currentIndex) {

 // Pick an element
apm install linter
gem install rubocop
apm install linter-rubocop
@jzntam
jzntam / rails-apis.md
Created December 3, 2016 11:33 — forked from dideler/rails-apis.md
From Code School's Zombies series

API Best Practices

Routes

Restricting routes

resources :zombies, only: [:index, :show]
resources :humans, except: [:destroy, :edit, :update] 
@jzntam
jzntam / routes.md
Created December 3, 2016 11:33 — forked from dideler/routes.md
Rails Routes

A summary of the Rails Guides on Routes, plus other tips.

The Rails router recognizes URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.

Examples

# Redirects /orders/report to orders#report.
get 'orders/report', to: 'orders#report'