Skip to content

Instantly share code, notes, and snippets.

@garciadanny
garciadanny / ng-model-filter-1.html
Created November 10, 2014 03:22
BlogPost: AngularJS Custom Directives
<table>
<tr ng-repeat="studio in studios | filter:status:true" >
<td>{{studio.name}}</td>
<td>{{studio.status}}</td>
</tr>
</table>
@garciadanny
garciadanny / ng-model-filter-2.html
Last active August 29, 2015 14:09
BlogPost: AngularJS Custom Directives
<select ng-model="status" ng-options="profile.status as profile.status for profile in profiles | unique:'status'" >
<option value="">All</option>
</select>
<select ng-model="city" ng-options="profile.city as profile.city for profile in profiles | unique:'city'" >
<option value="">All</option>
</select>
<table>
...
.highlight { background-color: #49483e }
.c { color: #75715e } /* Comment */
.err { color: #960050; background-color: #1e0010 } /* Error */
.k { color: #66d9ef } /* Keyword */
.l { color: #ae81ff } /* Literal */
.n { color: #f8f8f2 } /* Name */
.o { color: #f92672 } /* Operator */
.p { color: #f8f8f2 } /* Punctuation */
.cm { color: #75715e } /* Comment.Multiline */
.cp { color: #75715e } /* Comment.Preproc */
.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;
@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.

@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.

Bootstrap3 | HTML | Less

Bootstrap3 Gridsystem

Bootstrap3 has 4 column size class variants

col-xs-*
col-sm-*
col-md-*
col-lg-*
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
#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)
@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