This file contains 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 UIKit | |
import AVFoundation | |
import AVKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
let item = AVPlayerItem(URL: NSURL(string: "http://i.imgur.com/4WHLcYw.mp4")!) |
This file contains 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 main | |
types = ["Comment", "Link", "Message", "More", "Subreddit", "Listing", "Multireddit", "MultiredditDescription", "Account"] | |
part1 = "" | |
part2 = "" | |
part3 = "" | |
types.each{|type| | |
part1 = part1 + sprintf($temp1, type, type) |
This file contains 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
extension CollectionType { | |
func foldr<B>(accm:B, f: (Self.Generator.Element, B) -> B) -> B { | |
var g = self.generate() | |
func next() -> B { | |
return g.next().flatMap {x in f(x, next())} ?? accm | |
} | |
return next() | |
} | |
func foldl<B>(accm:B, f: (Self.Generator.Element, B) -> B) -> B { |
This file contains 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
// | |
// foldrTests.swift | |
// foldrTests | |
// | |
// Created by sonson on 2015/08/04. | |
// Copyright © 2015年 sonson. All rights reserved. | |
// | |
import XCTest |
This file contains 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
// About character counting in UTF-8 and Swift | |
var str = "かきくがぎぐ🇯🇵" | |
str.characters.count | |
str.unicodeScalars.count | |
let s1 = "\u{E9}" | |
let s2 = "\u{65}\u{301}" | |
// Compatibility equivalence and Canonical Equivalent |
This file contains 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
// | |
// escapeTests.swift | |
// escapeTests | |
// | |
// Created by sonson on 2015/09/18. | |
// Copyright © 2015年 sonson. All rights reserved. | |
// | |
import XCTest | |
//@testable import escape |
This file contains 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
#include <stdio.h> | |
int hoge(); | |
int main(int argc, char**argv) { | |
hoge(1); | |
printf("test\n"); | |
return 0; | |
} |
This file contains 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
// | |
// RedditParser.swift | |
// redditParser | |
// | |
// Created by sonson on 2015/09/22. | |
// Copyright © 2015年 sonson. All rights reserved. | |
// | |
import Foundation |
This file contains 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
// Halide | |
#include "Halide.h" | |
// Include some support code for loading pngs. | |
#include "halide_image_io.h" | |
// for performance test | |
#include <sys/time.h> | |
double currentTime() { | |
timeval t; |
This file contains 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
#include <stdlib.h> | |
#include <stdio.h> | |
int main(int argc, char **argv) { | |
printf("%ld\n", sizeof("ab ")); | |
return 0; | |
} |