Skip to content

Instantly share code, notes, and snippets.

@clojj
clojj / gist:216a7d274878420ac053
Created Apr 20, 2015
parallel grep recursively for STRING-content (requires GNU parallel package)... replace STRING with what you are looking for !
View gist:216a7d274878420ac053
find . -type f | parallel -k -j150% -n 1000 -m grep -i -H -n 'STRING' {}
@clojj
clojj / git_protokoll_https
Created Apr 24, 2015
Fix '... npm / bower unable to connect to github ... git://' during npm install
View git_protokoll_https
git config --global url."https://".insteadOf git://
View Example.java
@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 / plugin.groovy
Last active Aug 29, 2015
Runs in LivePlugin for IntelliJ
View plugin.groovy
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
@clojj
clojj / kahn.clj
Last active Aug 29, 2015 — forked from alandipert/kahn.clj
Kahn's topological sort in Clojure
View kahn.clj
;; 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 Aug 29, 2015
highlight Cursive code
View plugin.groovy
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
View parFold.hs
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 / session.js
Created Mar 2, 2016
nodegit session
View session.js
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(
View .emacs (brew emacs-mac; OS X)
(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 / .spacemacs
Last active Jul 10, 2016
.spacemacs
View .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