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
| set spacenumber to 9 | |
| tell application "System Events" | |
| set _desktops to every desktop | |
| if (count of _desktops) > 1 then | |
| -- if you have multiple displays (eg: external monitor) ask which | |
| display dialog "Choose your screen." buttons (get display name of every desktop) default button 1 | |
| set _display to the button returned of the result | |
| else | |
| -- else set the one display as selected |
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
| // closures | |
| func makeIncr() -> (Int -> Int) { | |
| var n = 0 | |
| return { x in n += x; return n } | |
| } | |
| let inc1 = makeIncr() | |
| let inc2 = makeIncr() | |
| println("inc1 +1 \(inc1(1))") | |
| println("inc2 +1 \(inc2(1))") |
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
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| func makeIncr() -> (Int -> Int) { | |
| var x = 0 | |
| return { y in x += y; return x } | |
| } | |
| let inc1 = makeIncr() |
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
| -(void)update:(CFTimeInterval)currentTime { | |
| static CFTimeInterval lastObstacleAt = 1; | |
| static CFTimeInterval pausedLoopAt; | |
| if (self.paused) { | |
| if (!pausedLoopAt) { | |
| pausedLoopAt = currentTime; | |
| } | |
| return; | |
| } else if (pausedLoopAt) { | |
| lastObstacleAt += currentTime - pausedLoopAt; |
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
| (defn rtake | |
| [n lst] | |
| (if (= n 0) | |
| () | |
| (cons (first lst) | |
| (rtake (dec n) (rest lst))))) | |
| (def my-first (partial rtake 1)) | |
| (defn rzip |
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 [won-subboard (fn [board] | |
| (let [all-equal (fn [v] (and (apply = v) (first v)))] | |
| (or | |
| ; horizontal lines | |
| (all-equal (subvec board 0 3)) | |
| (all-equal (subvec board 3 6)) | |
| (all-equal (subvec board 6 9)) | |
| ; vertical lines | |
| (all-equal (vals (select-keys board [0 3 6]))) | |
| (all-equal (vals (select-keys board [1 4 7]))) |
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
| (ns blog.precompile | |
| (:require [me.raynes.fs :as fs] | |
| [cljs.closure :as cljsc] | |
| [clojure.java.io :as io]) | |
| (:import [javax.script ScriptEngineManager ScriptException])) | |
| (defn eval-js | |
| [js] | |
| (let [engine (.getEngineByName (ScriptEngineManager. ) "nashorn")] | |
| (.eval engine js))) |
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
| /***************************************************** | |
| * SLADE Configuration File | |
| * Don't edit this unless you know what you're doing | |
| *****************************************************/ | |
| cvars | |
| { | |
| archive_load_data 0 | |
| elist_colname_width 80 | |
| elist_colsize_width 64 |
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
| // | |
| // ViewController.swift | |
| // AnimDemo | |
| // | |
| // Created by James Cash on 17-02-16. | |
| // Copyright © 2016 Occasionally Cogent. All rights reserved. | |
| // | |
| import UIKit |
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
| [ | |
| { | |
| "backcolor": "#ffffff", | |
| "name": "Dvorak LCD", | |
| "author": "Bart Nagel", | |
| "background": { | |
| "name": "Maple orange", | |
| "style": "background-image: url('/bg/wood/maple-orange.jpg');" | |
| }, | |
| "switchMount": "alps", |