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
// Compile with `swiftc switch.swift` | |
enum A { | |
case A(Int) | |
case B(Bool) | |
case C | |
case D | |
} | |
enum 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
enum A { | |
case A1 | |
} | |
enum B { | |
case B1 | |
var a: A { | |
return .A1 | |
} | |
} |
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
//select ::[a] ->[(a, [a])] | |
//select[] = [] | |
//select(x:xs) = (x, xs) : [(y, x:ys) | (y, ys) <-select xs] | |
func select<T>(input: [T]) -> [(T, [T])] { | |
if (input.isEmpty) { | |
return [] | |
} else { | |
let head = input[0] | |
let rest = Array(input[1..<input.count]) |
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
protocol BaseProtocol {} | |
protocol ExtendedProtocol: BaseProtocol {} | |
class A<T: BaseProtocol> { | |
private let t: T | |
init(a: T) { self.t = a } | |
} | |
class B<T: ExtendedProtocol> { |
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
#!/usr/bin/perl -w | |
use strict; | |
use Path::Iterator::Rule; | |
use String::ShellQuote; | |
# Makefile generator for quick compilation of Swift projects | |
# By: Roopesh Chander | |
# Thanks: Andy Matuschak | |
# Works only for swift-only projects. |
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
#!/usr/bin/perl -w | |
use strict; | |
# Makefile generator for quick compilation of Swift projects | |
# By: Roopesh Chander | |
# Thanks: Andy Matuschak | |
# Works only for swift-only projects. | |
# Usage: | |
# > perl makemake.pl | |
# > make |
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
Incident Identifier: 0A56BB09-A7BF-40D4-9318-704746E02D80 | |
CrashReporter Key: 34179ee1342c333e108a7bdd82b07ba9bb595bfc | |
Hardware Model: iPhone7,2 | |
Process: Spotify [1254] | |
Path: /private/var/mobile/Containers/Bundle/Application/4841D500-3B9C-4340-960A-52F8D8ADAD2E/Spotify.app/Spotify | |
Identifier: com.spotify.client | |
Version: 170100007 (1.7.1) | |
Code Type: ARM (Native) | |
Parent Process: launchd [1] |
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
#!/bin/bash | |
if [[ -n "$1" ]]; then | |
if [[ $2 == '--good' ]]; then | |
ffmpeg -i "$1" -r 24 -vcodec png out-static-%05d.png | |
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > "$1".gif | |
rm out-static*.png | |
else | |
ffmpeg -i "$1" -s 600x400 -pix_fmt rgb24 -r 24 -f gif - | gifsicle --optimize=3 --delay=3 > "$1".gif | |
fi |
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
// | |
// MSRegex.cpp | |
// CoreMS | |
// | |
// Created by Nacho Soto on 6/27/14. | |
// Copyright (c) 2014 MindSnacks. All rights reserved. | |
// | |
#include "MSRegex.h" |
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
#!/bin/bash | |
if [[ -n "$1" ]]; then | |
if [[ $2 == '--good' ]]; then | |
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png | |
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif | |
rm out-static*.png | |
else | |
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 24 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif | |
fi |