Skip to content

Instantly share code, notes, and snippets.

/*Selects all h4 within .container, including h4 nested within .container's children elements*/
.container h4 {
color: blue;
}
/*Selects only immediate child h4 of .container. Does not include h4 nested within child elements of .container*/
.container > h4 {
color: red;
}
@tbogin
tbogin / usingMongoDB.md
Last active June 29, 2017 19:54
Using Mongo DB
  1. Download MongoDB
  2. Open the MongoDB console with

mongo

  1. db.createCollection(banana) will create a collection named banana
  2. db.banana.insert({name: "Cavendish"}) will create a new record in your banana collection of {name: "Cavendish"} db.banana.find() will bring up the banana collection Start mongo server with

mongod

@tbogin
tbogin / start_react.md
Last active October 7, 2016 16:07
Getting started with React

##React environment setup ####React is the most intimidating library I've come across as a new programmer. But it's easier than it initially looks ####The 14 (I swear it's fewer than it seems) steps below will get you started with React

####You'll need to install the package manager NPM before coding with React. Since NPM comes with Node.js, it's easiest to download Node ####You can quickly do that here https://nodejs.org/en/download/

####Set up your React environment

  1. $mkdir root_directory && cd root_directory
  2. $npm init in order to create an NPM environment. You'll be asked several questions whenever you init an NPM project. It's more than fine to leave all fields blank, continuing until NPM asks you if everything is okay. Confirm 'yes'
@tbogin
tbogin / install_compass.md
Last active September 21, 2016 20:29
Compass Gem - getting started

##Compass gem - getting started ###The Compass gem provides an easy way to compile .scss files into .css ####Since browsers currently only read .css files, .scss must be compiled to raw CSS before it can be viewed on a screen

##Install Compass

  1. If you have Ruby on your computer, run $gem install compass anywhere on the command line
  2. That's it!

##Set up a new project with Compass

  1. $compass create directoryName
@tbogin
tbogin / sqlite_to_postgres.md
Last active October 7, 2016 16:08
Migrating a Rails app from SQLite to Postgres

##Migrate a SQLite app to PostgreSQL in order to deploy to Heroku ###Continue only if you're fine dropping your existing database.

  1. Make a new, empty rails app with PostgreSQL: $rails new app_name --database=postgresql
  2. Copy the database.yaml file of your brand new app, and paste it in your old app, replacing the old app's database.yaml file
  3. Throughout database.yaml, replace the new app’s name with the old app's name
  4. $bundle update, $db:create, $db:migrate
  5. Yay!