Skip to content

Instantly share code, notes, and snippets.

View ahoy-jon's full-sized avatar
🐋
Thinking!

Jonathan Winandy ahoy-jon

🐋
Thinking!
View GitHub Profile
package autoApplicativeBuilder
import shapeless.CaseClassMacros
import scala.annotation.StaticAnnotation
import scala.language.existentials
import scala.language.experimental.macros
import scala.reflect.internal.annotations.compileTimeOnly
import scala.reflect.macros.Context
@ahoy-jon
ahoy-jon / expand.clj
Created February 1, 2014 17:01
expand-clj
(for [[a b] [[1 2] [3 4] [5 6]] :when (> a 1)] (* a b))
;; expand
(let*
[iter__4590__auto__
(fn*
iter__8366
([s__8367]
(new
(ns cdl.graph
(:refer-clojure :exclude [==])
(:use [clojure.core.logic][clojure.core.logic.pldb])
(:require [clojure.core.logic.fd :as fd]))
;; taken from cypher examples ...
(def a 10) ;; assign 10 to a
a ;=> 10
(inc a) ;=> 11
(inc (inc a)) ;=> 12
a ;=> 10
#!/bin/bash
IN=$1
OUT="TODELETE_$1"
read_dom () {
local IFS=\>
read -d \< ENTITY CONTENT
local RET=$?
TAG_NAME=${ENTITY%% *}
import java.util.Arrays;
import java.util.Scanner;
public class G2048 {
static char EMPTY = ' ';
static String UP = "UP";
static String DOWN = "DOWN";
static String LEFT = "LEFT";
static String RIGHT = "RIGHT";
class TestUtils {
public static void should(boolean b){
if(!b) {
throw new RuntimeException("failed");
}
}
}
class Vect {
final double x;
final double y;
Vect(double x, double y) {
this.x = x;
this.y = y;
}
@ahoy-jon
ahoy-jon / 0_reuse_code.js
Created April 7, 2014 09:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
(defmacro defmodule
[name slots & specs]
(let [fields (->> slots (partition 2) (map first) vec)
defaults (->> slots (partition 2) (map second))
pdef (map (partial take 2) specs)
pname (symbol (str "I" name))]
`(do
(defprotocol ~pname ~@pdef)
(defrecord ~name ~fields ~pname ~@specs)