Skip to content

Instantly share code, notes, and snippets.

View timsgardner's full-sized avatar

Tims Gardner timsgardner

  • Brooklyn, NY
View GitHub Profile
using System;
namespace clojure_west.stupid_idea
{
public interface ISack
{
//
// Methods
//
object whats_in_me ();
(ns clojure-west.stupid-idea)
(defprotocol ISack
(whats-in-me [this]))
(defn potato-sack [the-potatos]
(reify ISack
(whats-in-me [_] the-potatos)))
// NAME:
// psdDigest
// DESCRIPTION:
// Saves each layer in the active document to a PNG or JPG file named after the layer.
// These files will be created in "/Interface" relative path folder placed from current document director
// REQUIRES:
// Adobe Photoshop CS2 or higher
@timsgardner
timsgardner / gist:9d68c39bce690fe0fa5f
Created September 11, 2015 02:25
psdDigest, the better
// NAME:
// psdDigest
// DESCRIPTION:
// Saves each layer in the active document to a PNG or JPG file named after the layer.
// These files will be created in "/Interface" relative path folder placed from current document director
// REQUIRES:
// Adobe Photoshop CS2 or higher
@timsgardner
timsgardner / comp-pro .clj
Last active September 12, 2015 09:07
comp-pro
(defmacro ^:private defn-meval [& preamble-and-meval-to-forms]
(let [preamble (butlast preamble-and-meval-to-forms)
meval-to-forms (last preamble-and-meval-to-forms)
mevaluated (eval meval-to-forms)]
`(defn ~@preamble
~@mevaluated)))
(defn-meval comp-pro
(let [fargs (repeatedly gensym)
xarg (gensym "xarg")]
(defn over-color ^Color [^Color a
^Color b]
(let [^Vector4 a (v4 (.r a) (.g a) (.b a) (.a a))
^Vector4 b (v4 (.r b) (.g b) (.b b) (.a b))
c (Vector4/op_Addition
(Vector4/op_Multiply a (float (.w a)))
(Vector4/op_Multiply
(Vector4/op_Multiply b (float (.w b)))
(- 1 (.w a))))
blend (+ (.w a)
(defmacro swiz [v spec]
(let [spec (name spec)
op (case (count spec)
2 'v2
3 'v3
4 'v4)
vsym (gensym "v_")]
`(let [~vsym ~v]
(~op ~@(map #(list '. vsym (symbol (str %))) spec)))))
using clojure.lang;
using System;
[Serializable]
public class clojure_west/stupid_idea$volatile_fun_test$fn__499__503 : AFunction
{
//
// Static Fields
//
protected internal static object const__0;
using Cubiquity;
public class CubiquityHelper{
public static void stupidTest(uint n){
bool[] ar = new bool[1];
for(int i = 0; i < n; i++){
ar[0] = true;
}
;; works
(-> [[1 0] [1 0]]
(System.Linq.Enumerable/SelectMany identity)
vec)
;; doesn't
(-> [[1 0] [1 0]]
(System.Linq.Enumerable/SelectMany identity)
(System.Linq.Enumerable/Distinct (type-args System.Linq.Enumerable))
vec)