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
#!/bin/sh | |
lsof -tn -i:$1 -sTCP:LISTEN | xargs kill |
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
# coding: utf-8 | |
require "ostruct" | |
require "fileutils" | |
require "pp" | |
require "pathname" | |
require "rake/loaders/makefile" | |
### Variables ### |
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
let a = [["a","b"],["x","y"]] | |
let b = a.enumerate().flatMap { (i, a) in a.enumerate().map { (i, $0.0, $0.1) } } | |
b.forEach { (i, j, e) in | |
print("a[\(i)][\(j)] = \(e)") | |
} |
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
http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8 |
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 scala.collection.immutable.SortedMap | |
import scala.util.Random | |
class WRR[+A](total: Int, map: SortedMap[Int, A]) { | |
require(!map.isEmpty) | |
def pick(rand: Random): A = map.until(rand.nextInt(total) + 1).last._2 | |
} | |
object WRR { | |
def apply[A](e: (Int, A), a: (Int, A) *): WRR[A] = { |
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 scalaz._ | |
import scalaz.iteratee.Iteratee._ | |
import scalaz.iteratee._ | |
import scalaz.iteratee.StepT.{Done, Cont} | |
import Scalaz._ | |
import scala.util.{Try, Success, Failure} | |
case class ~[A, B](a: A, b: B) |
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
struct EquatesByAddress: Equatable { let raw: AnyObject? } | |
func ==(lhs: EquatesByAddress, rhs: EquatesByAddress) -> Bool { | |
return lhs.raw === rhs.raw | |
} |
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 android.opengl.GLES20; | |
import android.view.Surface; | |
import javax.microedition.khronos.egl.EGL10; | |
import javax.microedition.khronos.egl.EGLConfig; | |
import javax.microedition.khronos.egl.EGLContext; | |
import javax.microedition.khronos.egl.EGLDisplay; | |
import javax.microedition.khronos.egl.EGLSurface; | |
public class SurfaceUtil { |
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
class Coord private (val degree: Int) { | |
override def toString: String = degree + "deg" | |
} | |
object Coord { | |
def normalize(deg: Int): Int = if (deg < 0) normalize(deg + 360) else deg % 360 | |
def apply(deg: Int): Coord = new Coord(normalize(deg)) | |
} |
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 RxSwift | |
let Completed = NSError(domain: "Completed", code: 0, userInfo: nil) | |
class CountdownTimer { | |
private let publisher = PublishSubject<Int>() | |
private let signal: Observable<Int> | |
init(_ count: Int) { |