Skip to content

Instantly share code, notes, and snippets.

@garciadanny
garciadanny / http_rest.md
Last active October 12, 2016 09:21
A beginners guide to HTTP and REST. Notes taken from codecademy.com

#HTTP and REST

Hypertext Transfer Protocal

  • Whenever you navigate a site though links, you're making a state transition, bringing you to the next page. Representing the next state of the application.
Client sends request to server, server returns a response.
  • In order for a client and a server to speak to each other, they follow a set of principles called REST (Representational State Transer).

API

@garciadanny
garciadanny / using_gistify.md
Created November 30, 2013 06:30
A quick description of gistify

Gistify

Easily create gists from the command line.

This gist was created using Gistify.

See documentation here

@garciadanny
garciadanny / example.rb
Created November 30, 2013 19:42
example using the gistify gem
def example
puts 'using gistify'
end
@garciadanny
garciadanny / capture_stdout.rb
Created December 1, 2013 02:14
Capturing stdout for testing
# hirb / test / test_helper.rb
require 'bacon'
require 'bacon/bits'
require 'mocha-on-bacon'
require 'hirb'
include Hirb
module TestHelpers
# set these to avoid invoking stty multiple times which doubles test suite running time
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
class Employee
include ActiveSupport::Configurable
end
employee = Employee.new
employee.config.research_lab_entry = :not_allowed
employee.config.paid_leave = 5
class Employee
include ActiveSupport::Configurable

Bootstrap3 | HTML | Less

Bootstrap3 Gridsystem

Bootstrap3 has 4 column size class variants

col-xs-*
col-sm-*
col-md-*
col-lg-*
@garciadanny
garciadanny / css_intro.md
Created June 1, 2014 23:58
Intro to CSS

#CSS

Cascading Style Sheets

Styles are applied in cascading order. Therefore css set on a <p> for example will get overridden by css that comes after it.

Inheritance & Specificity

If you set a property in a parent element, any child elements will also inherite those styles unless you override them.

@garciadanny
garciadanny / angular_js_intro.md
Last active August 29, 2015 14:04
NOTES TAKEN GOING THROUGH A TUTORIAL

Angular.JS

A client-side JS framework for adding interactivity to HTML.

How do we tell our HTML when to trigger our JS?

Directives

A directive is a marker on an HTML tag that tells Angular to run or reference some JS code. It's how we bind our HTML or behavior.

.highlight {
background-color: #efefef;
padding: 7px 7px 7px 10px;
border: 1px solid #ddd;
-moz-box-shadow: 3px 3px rgba(0,0,0,0.1);
-webkit-box-shadow: 3px 3px rgba(0,0,0,0.1);
box-shadow: 3px 3px rgba(0,0,0,0.1);
margin: 20px 0 20px 0;
overflow: hidden;