Skip to content

Instantly share code, notes, and snippets.

View anaclair's full-sized avatar

Ana Nelson anaclair

View GitHub Profile
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)
@stujo
stujo / application.html.erb
Created September 30, 2015 17:33
Page Specific Document Ready JavaScript in Rails with jQuery
<!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>
@stujo
stujo / asset-pipeline.md
Created September 30, 2015 15:59
Stujo's Rails Asset Pipeline Notes
@stujo
stujo / README.md
Last active September 29, 2015 18:11
Intro to Rails from Sinatra Notes - Stujo
@mos3abof
mos3abof / tower_of_hanoi.py
Created March 24, 2013 14:24
Classic puzzle "Tower of Hanoi" recursive solution in python
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)