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
{:user {:dependencies [[org.clojure/tools.namespace "0.2.3"] | |
[spyscope "0.1.3"] | |
[criterium "0.4.1"]] | |
:injections [(require '(clojure.tools.namespace repl find)) | |
; try/catch to workaround an issue where `lein repl` outside a project dir | |
; will not load reader literal definitions correctly: | |
(try (require 'spyscope.core) | |
(catch RuntimeException e))] | |
:plugins [[lein-pprint "1.1.1"] | |
[lein-beanstalk "0.2.6"] |
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
pub type V3 = [usize; 3]; | |
#[derive(Clone, Copy, Debug, PartialEq, Eq)] | |
pub struct PositionedVolume { | |
dimensions: V3, | |
position: V3, | |
} | |
// mutable stack of sub-containers, initialized with input container | |
// mutable vec of remaining items, initialized with all input items |
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
-- paste into http://elm-lang.org/try and click "compile" | |
-- http://imgur.com/gallery/W6TwgZw | |
import Graphics.Collage exposing (..) | |
import Graphics.Element exposing (..) | |
import Text | |
import Color exposing (..) | |
import Time | |
import Signal |
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
Show hidden characters
// installed Clojure packages: | |
// | |
// * BracketHighlighter | |
// * lispindent | |
// * SublimeREPL | |
// * sublime-paredit | |
{ | |
"word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?", | |
"paredit_enabled": true, |
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
### Keybase proof | |
I hereby claim: | |
* I am jamesmacaulay on github. | |
* I am jamesmacaulay (https://keybase.io/jamesmacaulay) on keybase. | |
* I have a public key ASDnKw1JsZHofgcB89uvNLIux6FkTNSz64gv8aS99WWGXgo | |
To claim this, I am signing this object: |
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
# git-freeze: take the current index and working tree state and "freeze" them | |
# by creating a commit for each as necessary | |
# | |
# git-thaw: look for commits created by git-freeze and restore them to | |
# working tree or index as appropriate | |
# alias gf='git-freeze' | |
# alias gt='git-thaw' | |
function git-freeze () { |
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 | |
lastlast=$(last --time-format=iso -1 -R | head -1 | awk '{ print $3 "\n" $5 }' | xargs -n1 date +%s -d 2> /dev/null) | |
lastuserinputs=$(who -s | awk '{ print $2 }' | (cd /dev && xargs stat -c '%X')) | |
events=$lastlast$'\n'$lastuserinputs | |
sincelatestevent=$(echo "$events" | sort -rn | head -1 | awk '{ print '"$(date +%s)"'-$1 }') | |
uptime=$(cat /proc/uptime | sed -n 's/\([0-9]*\).*/\1/p') | |
durations=$sincelatestevent$'\n'$uptime | |
idletime=$(echo "$durations" | sort -n | head -1) | |
echo "$idletime" |
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
module DQuery | |
import Record | |
namespace Json | |
data Json | |
= JsonString String | |
| JsonBool Bool | |
| JsonInt Int | |
| JsonObject (List (String, Json)) |
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
module Main exposing (main) | |
import Html exposing (Html, text) | |
import Json.Bidirectional as Json | |
import Json.Decode as Decode | |
import Json.Encode as Encode | |
import String | |
import Tuple | |
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
-- inspired by: https://groups.google.com/d/msg/elm-discuss/2LxEUVe0UBo/ZgJ_ldUH6ygJ | |
-- thanks for the help: http://learnyouahaskell.com/functors-applicative-functors-and-monoids | |
module UserDecoder where | |
import Date exposing (Date) | |
import User exposing (User) | |
import Json.Decode as Js exposing ((:=)) | |
-- Applicative's `pure`: |
NewerOlder