Skip to content

Instantly share code, notes, and snippets.

View stoeckley's full-sized avatar

andrew stoeckley

  • Balcony Studio
  • Netherlands
View GitHub Profile
;; Copyright (c) James Reeves. All rights reserved.
;; The use and distribution terms for this software are covered by the Eclipse
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which
;; can be found in the file epl-v10.html at the root of this distribution. By
;; using this software in any fashion, you are agreeing to be bound by the
;; terms of this license. You must not remove this notice, or any other, from
;; this software.
(ns compojure.server.jetty
"Clojure interface to start an embedded Jetty server."
(def inputs [{:korks :email}
{:korks [:name :first]}
{:korks [:name :last]}])
(defn form [app owner]
(reify
om/IInitState
(init-state [this]
(reduce (fn [state {:keys [korks]}]
(assoc-in state korks nil))
(defn clj->js
"Recursively transforms ClojureScript maps into Javascript objects,
other ClojureScript colls into JavaScript arrays, and ClojureScript
keywords into JavaScript strings."
[x]
(cond
(string? x) x
(keyword? x) (name x)
(map? x) (.strobj (reduce (fn [m [k v]]
(assoc m (clj->js k) (clj->js v))) {} x))
@stoeckley
stoeckley / fun.swift
Last active August 29, 2015 14:24 — forked from erica/fun.swift
Start with an array of optionals and flat whack the heck out of 'em.
flatMap
let results = arrayOfOptionals.flatMap({$0})
for case
var results = [String]()
for case let value? in arrayOfOptionals {results.append(value)}
@stoeckley
stoeckley / gist:00a37a186f1379b10adf
Created November 26, 2015 12:10
destructure as vector elements of map
(let [[[a b]] (seq {:a 22})]
[a b])
=> [:a 22]
;; could also use vec instead of seq, but seq is more generic for this case
@stoeckley
stoeckley / .gitignore
Created December 20, 2015 09:31 — forked from BennettSmith/.gitignore
Google Protobuf v2.6.0 Build Script for iOS
protobuf
protobuf-2.6.0
protobuf-2.6.1
protobuf-master
@stoeckley
stoeckley / .gitignore
Created December 24, 2015 09:02 — forked from Gubarev/.gitignore
Google Protobuf v2.6.0 Build Script for iOS
protobuf
protobuf-2.6.0
protobuf-master
@stoeckley
stoeckley / encrypted-git-repo.md
Created January 18, 2016 18:46
Transparent Git Encryption

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang (geek@cerias.net). It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].

Description

When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

@stoeckley
stoeckley / FastFunc.hpp
Created January 29, 2016 07:33 — forked from vittorioromeo/FastFunc.hpp
Don Clugston's fast delegate C++11 implementation
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>
@stoeckley
stoeckley / Makefile
Created May 2, 2016 17:12 — forked from kanedo/Makefile
Makefile for Xcode C++ projects
#############################################################
# #
# Generic Makefile for C++ projects #
# Author: Gabriel <software@kanedo.net> #
# Date: 2014-04-18 #
# Version: 1.0 #
# #
#############################################################