Skip to content

Instantly share code, notes, and snippets.

@monicao
monicao / notes.md
Last active December 8, 2021 01:51
Setting up your own Ruby Dev Environment on a Mac

Setting up the Ruby dev environment on a Mac

Tested on Yosemite. Should work on El Cap. Message me if it doesn't.

Why would I want to do that?

  • You are tired of using vagrant
  • You want to run guard
  • You want use Sublime plugins (like RSpec or Guard plugins)
  • You want your code to run faster in development
@monicao
monicao / rails_testing.md
Last active June 22, 2021 16:55
Setting up rails 4 with MiniTest, Fabrication and Guard
# Gemfile
group :development, :test do
  gem 'minitest-rails'
  gem 'fabrication'
end
@monicao
monicao / react.md
Last active February 23, 2021 19:07
React Lifecycle Cheatsheet

React Component Lifecycle

  • getInitialState
  • getDefaultProps
  • componentWillMount
  • componentDidMount
  • shouldComponentUpdate (Update only)
  • componentWillUpdate (Update only)
  • componentWillReceiveProps (Update only)
  • render
@monicao
monicao / notes.md
Last active July 28, 2020 00:18
4 Reasons to Learn JavaScript Before CoffeeScript

CoffeeScript was written by Jeremy Ashkenas, a Ruby developer who was fed up with the quirks of JavaScript. It was an instant success in the Ruby community. Many people were tired of having to type === instead of ==, of JavaScript's crappy lexical scoping, of having to jump through hoops to set up even the most simple inheritance structure, of variables leaking into the global scope or having to worry about silly things like hoisting.

This was a time when web user interfaces were becoming more complex and backend developers had to spend more and more time writing JavaScript code. For a long time, coding in JavaScript meant you spent 100% of your time using jQuery. And what an epic mess that was!

At that time many people did not consider JavaScript to be a real programming language, because of it's oddities. So when CoffeeScript came along developers (especially Ruby developers) embraced it as a way to make coding in JavaScript suck less. I was one of those developers. I liked that CoffeeScript automatic

@monicao
monicao / notes.md
Created May 20, 2016 20:15
Deploying Sinatra to Heroku

It's time to deploy your app! H0Lee S#!T...
-- Khurram Virani, 2014

Introduction

Localhost is great and all, but at some point you might want to deploy other app to the wild (the internets) for others to be able to use it.

When an app is live, it’s often referred to as the "production" instance/server of your app. Your your local server (on localhost) which only you can use is referred to the "development" instance.

There are many options on how and where to deploy your web app. The simplest approach is to use a Platform as a Service (PaaS). A PaaS abstracts away many of the complexities associated with setting up, configuring and deploying to a machine in the cloud. Heroku is the most popular platform of this kind.

@monicao
monicao / tdd_notes.md
Last active May 22, 2017 11:35
TDD Lecture Notes

What is TDD?

  • write a test first
  • see it fail
  • write the implementation
  • see the test pass "the red green loop"

How much should you test?

@monicao
monicao / keybase.txt
Created February 21, 2017 20:06
keybase
### Keybase proof
I hereby claim:
* I am monicao on github.
* I am mochromatic (https://keybase.io/mochromatic) on keybase.
* I have a public key whose fingerprint is 8937 15D3 B7A0 E644 C70A CF66 7AFF 9902 34AA BBDA
To claim this, I am signing this object:
@monicao
monicao / closureExample.js
Created September 8, 2016 23:30
W4D3 Breakout Closures
/*
* Question: What is the difference between the two ways of declaring functions in JavaScript?
*/
//
// Declaring a function with var.
//
@monicao
monicao / gist:5565307
Created May 12, 2013 23:10
Angular minification settings for the asset pipeline
TestApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
config.assets.digest = true
config.assets.compile = false
config.assets.compress = true
@monicao
monicao / dog.rb
Created March 13, 2013 19:41
An example of instance vs class variables
class Dog
# class variable
@@default_description = "A dog is a furry mammal."
attr_accessor :name
attr_accessor :age
attr_accessor :description
def initialize(name, description)