Skip to content

Instantly share code, notes, and snippets.

@walkingway
walkingway / parsing.swift
Last active January 31, 2016 10:36 — forked from chriseidhof/parsing.swift
JSON Parsing in Swift
// This code accompanies a blog post: http://chris.eidhof.nl/posts/json-parsing-in-swift.html
//
// As of Beta5, the >>= operator is already defined, so I changed it to >>>=
import Foundation
let parsedJSON : [String:AnyObject] = [
"stat": "ok",
"blogs": [
@walkingway
walkingway / acces_token
Last active August 29, 2015 14:13
生成七牛云存储列表用的 Access Token
require 'hmac-sha1'
require 'uri'
require 'base64'
def urlsafe_base64_encode(content)
Base64.encode64(content).strip.gsub('+', '-').gsub('/','_').gsub(/\r?\n/, '')
end
def generate_access_token(access_key, secret_key, url, body)
uri = URI.parse(url)