Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / index.html
Created November 7, 2015 23:04
Girls Learning Code: Live Code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Made with Thimble</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Monica's Favourite Animals</h1>
@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 / spec_helper.rb
Created August 27, 2014 00:31
Sample spec helper
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
@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 / 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 / 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