- Always Read the Rails Guides for Overviews
- Search for solutions on google
- Really only read the API Docs if things get really gnarly
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 hanoi(n, fr, to, spare): | |
'''(int, str, str, str) | |
Solve the classic puzzle Tower of Hanoi | |
>>> hanoi(1, "Middle", "Left", "Right") | |
- Move top ring in 'Middle' tower to the 'Left' tower | |
''' | |
def print_move(fr, to): | |
print "- Move top ring in '{}' tower to the '{}' tower".format(fr, to) |
#Asset Pipeline
#Bullet Points
- Rails Guides Asset Pipeline
- Any file in any subfolder:
app/assets
,lib/assets
,vendor/assets
, + gems...
- demo text file in assets subfolder
- JavaScript
- concatenate <- In Production
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>PizzaShack</title> | |
<%= stylesheet_link_tag 'application', media: 'all' %> | |
<%= javascript_include_tag 'application' %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> |
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
import Foundation | |
/// NSURLSession synchronous behavior | |
/// Particularly for playground sessions that need to run sequentially | |
public extension NSURLSession { | |
/// Return data from synchronous URL request | |
public static func requestSynchronousData(request: NSURLRequest) -> NSData? { | |
var data: NSData? = nil | |
let semaphore: dispatch_semaphore_t = dispatch_semaphore_create(0) |