Skip to content

Instantly share code, notes, and snippets.


Alex Chin alexpchin

View GitHub Profile
View gist:11147146

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt

What is REST?

REST stands for Representional State Transfer and is defined on Wikipedia as:

Representational state transfer (REST) is a software architectural style consisting of a coordinated set of architectural constraints applied to components, connectors, and data elements, within a distributed hypermedia system. REST ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements.

I think the second part of that explanation sounds like it could be quite interesting... but to me that all seems super complicated! So I've decided to try to simplify it for my own understanding. (If I have not understood something in this gist, please TELL ME!)

##Saving & Retrieving information For this section, think of a web application as a piece of software built to help people to store and access information online.

alexpchin /
Last active Aug 29, 2015
A story explaining MVC

A story explaining MVC

MVC stands for:

  • Models
  • Views
  • Controllers

It’s more fun to imagine the explainatin of MVC as a story with “a fat assistant, a skinny manager and a good looking sales rep" (fat model, skinny controller and well designed view) rather than a boring “3-tiered MVC architecture”.

alexpchin /
Last active Aug 29, 2015
Looking for a Decent Rails CMS

Rails Content Management Systems

When developing websites for small to medium clients, often a decent CMS is needed to get basic CRUD functionality and authentication off the ground quickly.

I've done a little bit of research into some of the most popular CMS platforms. Here are my quick thoughts.

1. Browser CMS

alexpchin / Deploying_to_Heroku
Last active Aug 29, 2015
Deploying to Heroku
View Deploying_to_Heroku
Deploying to Heroku
group :production do
gem 'rails_12factor'
# Enable the asset pipeline
config.assets.enabled = true
config.assets.initialize_on_precompile = false

HAML: the unforgivable sin

Repost from:

I used HAML on several client projects and I hated it every time. There are certainly some things that are nice about it, but overall it is a net loss.

##For abstraction’s sake Abstractions are a beautiful thing. The goal of an abstraction is to reduce or factor out irrelevant details. Removing details focuses you on the problem at hand and not the underlying implementation.

View Meta Tags
<!-- for Google -->
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="copyright" content="" />
<meta name="application-name" content="" />
<!-- for Facebook -->
<meta property="og:title" content="" />
<meta property="og:type" content="article" />
View DefaultKeyBinding.dict
/* Map # to § key*/
"§" = ("insertText:", "#");

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.