Skip to content

Instantly share code, notes, and snippets.

@jubinjacob19
jubinjacob19 / ui_test_sharder.py
Created July 3, 2020 05:56
Python Script to shard UITests in Xcode project
import os
import errno
import sys
shard_index = sys.argv[1]
PATH = os.path.dirname(os.getcwd())
TESTSPATH = os.path.join(PATH,"Example/UITests/")
tests = []
shard_tests = ""
@jubinjacob19
jubinjacob19 / YCombinator.swift
Last active November 4, 2017 04:39
The Y combinator in Swift. A single argument Y combinator is used to find the factorial of a number.
import Foundation
func Y<In, Out>(_ f :@escaping (@escaping(In) -> Out) -> (In) -> Out) -> (In) -> Out {
return {
d in f(Y(f))(d)
}
}
let factorial =
Y {(f) in
{ n in
@jubinjacob19
jubinjacob19 / YCombinator.kt
Last active March 4, 2020 03:43
The Y combinator in Kotlin. A single argument Y combinator is used to find the factorial of a number.
fun main(args: Array<String>) {
if (args.count() == 0) {
println("Please input a number")
} else {
try {
val n = args[0].toInt()
val factorial = y<Int,Int> {f-> { n->
if (n == 0) 1
else n * f(n - 1)
} }