Skip to content

Instantly share code, notes, and snippets.

@clojj
clojj / testByteStringUTF8.hs
Last active November 6, 2016 21:21
ByteStringUTF8 and loop over [Token]
#!/usr/bin/env stack
{-
stack --resolver lts-7.7 --install-ghc
runghc
--package utf8-string
-}
{-@ LIQUID "--notermination" @-}
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE OverloadedStrings #-}
@clojj
clojj / .spacemacs
Last active July 10, 2016 12:30
.spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
(desktop-save-mode 1)
;;FiraCode
(set-default-font "Fira Code 14")
(mac-auto-operator-composition-mode)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/") t)
@clojj
clojj / session.js
Created March 2, 2016 23:47
nodegit session
var Git = require("nodegit");
var Rx = require("rx");
var repo = Git.Repository.open(".")
var mc = repo.then(function(repo){return repo.getMasterCommit()})
var history = mc.then(
function(masterCommit){
var hist = masterCommit.history();
Rx.Observable.fromEvent(hist, 'commit').subscribe(
import Control.Parallel
import Data.List
pfold :: (Num a, Enum a) => (a -> a -> a) -> [a] -> a
pfold _ [x] = x
pfold mappend xs = (ys `par` zs) `pseq` (ys `mappend` zs) where
len = length xs
(ys', zs') = splitAt (len `div` 2) xs
ys = pfold mappend ys'
@clojj
clojj / plugin.groovy
Last active August 29, 2015 14:27
highlight Cursive code
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.LangDataKeys
import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.markup.EffectType
import com.intellij.openapi.editor.markup.HighlighterTargetArea
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.openapi.util.Condition
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
@clojj
clojj / kahn.clj
Last active August 29, 2015 14:27 — forked from alandipert/kahn.clj
Kahn's topological sort in Clojure
;; Copyright (c) Alan Dipert. 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)
;; 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 alandipert.kahn
(:require [clojure.set :refer [difference union intersection]]))
@clojj
clojj / plugin.groovy
Last active August 29, 2015 14:26
Runs in LivePlugin for IntelliJ
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.editor.markup.EffectType
import com.intellij.openapi.editor.markup.HighlighterTargetArea
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.LangDataKeys
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiRecursiveElementWalkingVisitor
@FunctionalInterface
interface TriFunction<T, U, V, R> {
R apply(T a, U b, V c);
}
public class Example {
public static int add(int x, int y) {
return x + y;
}
@clojj
clojj / git_protokoll_https
Created April 24, 2015 09:18
Fix '... npm / bower unable to connect to github ... git://' during npm install
git config --global url."https://".insteadOf git://