Skip to content

Instantly share code, notes, and snippets.

@shaharz
shaharz / advent2018.ipynb
Last active April 5, 2021 14:38
Advent of Code 2018 solutions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shaharz
shaharz / advent2017-day2.re
Created December 3, 2017 01:42
Advent of Code 2017 - day 2
// part 1
read_file("Downloads/input.txt")
|> List.map(Str.split(Str.regexp("[ \t]+")))
|> List.map(List.map(int_of_string))
|> List.map(
(l) =>
List.fold_left(
((mn, mx), cur) => (min(mn, cur), max(mx, cur)),
(List.hd(l), List.hd(l)),
l
l = require("lodash");
var a = ["Admiring", "Adoring", "Affectionate", "Appreciative", "Approving", "Bemused", "Benevolent", "Blithe", "Calm", "Casual", "Celebratory", "Cheerful", "Comforting", "Comic", "Compassionate", "Complimentary", "Conciliatory", "Confident", "Contented", "Delightful", "Earnest", "Ebullient", "Ecstatic", "Effusive", "Elated", "Empathetic", "Encouraging", "Euphoric", "Excited", "Exhilarated", "Expectant", "Facetious", "Fervent", "Flippant", "Forthright", "Friendly", "Funny", "Gleeful", "Gushy", "Happy", "Hilarious", "Hopeful", "Humorous", "Interested", "Introspective", "Jovial", "Joyful", "Laudatory", "Kind", "Kinky", "Klutzy", "Kitschy", "Kosher", "Light", "Lively", "Mirthful", "Modest", "Nostalgic", "Optimistic", "Passionate", "Placid", "Playful", "Poignant", "Proud", "Reassuring", "Reflective", "Relaxed", "Respectful", "Reverent", "Romantic", "Sanguine", "Scholarly", "Self-assured", "Sentimental", "Serene", "Silly", "Sprightly", "Straightforward", "Sympathetic", "Tender", "Tranquil"
@shaharz
shaharz / core.cljs
Last active September 15, 2016 08:55
React.js's CSSTransitionGroup in Om
(ns om-transition.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(enable-console-print!)
(def ctg (aget js/React "addons" "CSSTransitionGroup"))
(def app-state (atom ["test"]))
@shaharz
shaharz / friend_oauth.clj
Created January 27, 2014 16:47
Twitter/OAuth workflow for Friend
(ns friend-oauth
(:require
[cemerick.friend :as friend]
[cemerick.friend.workflows :refer [make-auth]]
[clj-http.client :as client]
[oauth.client :as oauth]
[ring.util.request :as request]))
(defn- which-oauth-uri
[config request]