This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventsController < ApplicationController | |
def index | |
@events = Event.all.reverse | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node | |
constructor: (val) -> | |
@val = val | |
@left = null | |
@right = null | |
findAncestors = (node, val, arr) -> | |
return false if node == null | |
if node.val == val | |
return arr.push(val) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def analyze_stocks(prices) | |
best_buy_day = nil | |
best_sell_day = nil | |
max_profit = 0 | |
prices.each_with_index do |buy_price, buy_day| | |
prices.slice(buy_day..prices.length).each_with_index do |sell_price, sell_day| | |
profit = sell_price - buy_price | |
if profit > max_profit | |
best_sell_day = buy_day + sell_day + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URI Versioning: | |
-Good for namespace routes | |
-Bad for aesthetics | |
Header: | |
-Good for pretty urls | |
-Bad cause its less clear what's happening and have to set on every request | |
Accept header: | |
-Kinda the same as header |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BinarySearchTree | |
constructor: () -> | |
@val = null | |
@size = 0 | |
@right = null | |
@left = null | |
insert: (val) -> | |
if (@val == null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module - way of compartmentalizing pieces of code for similar functionality | |
scope - app context | |
data binding - connecting UI and biz logic | |
directives - attach functionality to DOM | |
controllers - functionality for models | |
dependency injection - dependencies for controllers and modules | |
Discontinued in 2.0: | |
Controllers | |
Directive Definition Object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# view/comments/_form.html.haml | |
= form_for(@comment) do |f| | |
- if @comment.errors.any? | |
#error_explaination | |
%h2= pluralize(@comment.errors.count, 'error') | |
%ul | |
- @comment.errors.full_message.each do |message| | |
%li= message | |
.field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gemfile | |
# styles and structure for bourbon | |
gem 'bitters' | |
# sass mixins | |
gem 'bourbon' | |
# grid framework for bourbon | |
gem 'neat' | |
# patterns for bourbon | |
gem 'refills' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// framework_and_overrides.css.scss | |
@import "_settings"; | |
@import "foundation"; | |
// _settings.css.scss | |
$accent-color-1: #8bbb4b; | |
$topbar-bg-color: $accent-color-1; | |
$topbar-bg: $accent-color-1; | |
$topbar-dropdown-bg: $accent-color-1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ host philwilt.com | |
philwilt.com has address 64.74.223.6 | |
philwilt.com mail is handled by 10 p.nsm.ctmail.com. | |
$ dig philwilt.com | |
; <<>> DiG 9.8.5-P1 <<>> philwilt.com | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34499 |