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 Foundation | |
enum DepthChange { | |
case same | |
case increasing | |
case decreasing | |
} | |
func window(array: Array<Int>, ofSize size: Int) -> [[Int]] { | |
(size...array.count).map { startingIndex in |
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 * as fs from "fs" | |
import * as path from "path" | |
import * as v from "./util/vector" | |
type OutputImage = { | |
width: number, | |
height: number, | |
maxColor: number | |
} |
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
/* | |
## Expression Formatter | |
Build up an expression that can be formatted in a human way, for example: | |
"What is one plus two plus three plus four?" | |
"Answer: ten" | |
*/ | |
indirect enum Expression { | |
case number(Int) |
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
@{% | |
const lexer = require("./lexer"); | |
function flatten(arr) { | |
return arr.reduce(function (flat, toFlatten) { | |
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); | |
}, []); | |
} | |
%} | |
@lexer lexer |
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
// @flow | |
import React, { Component } from "react"; | |
import { Text, View, Image, StatusBar } from "react-native"; | |
import { Navigation } from "react-native-navigation"; | |
type Props = { | |
title: string, | |
fanartUrl: string, | |
description: string, |
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
// @flow | |
import React, { Component } from "react"; | |
import { Text, View, Image } from "react-native"; | |
import { Navigation } from "react-native-navigation"; | |
type Props = {}; | |
export default class extends Component<Props> { | |
render() { | |
return ( |
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
// Xcode 9 beta 4 | |
import UIKit | |
import PlaygroundSupport | |
struct Book { | |
let id: Int | |
let title: String | |
let author: String | |
} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
class Leaf: UIView { | |
var action: (Int) -> () = { _ in } | |
var missilesFired = 1 { | |
didSet { | |
label.text = "\(missilesFired) Missiles Fired" |
NewerOlder