This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example of get the position of the cursor in a line of a text buffer from a click event | |
function clickPositionToCharIndex(clickX){ | |
return comp( | |
map(measureCharWidth), | |
reductions((a,b) => a + b, 0), | |
takeWhile(x => x < clickX), | |
mapIndexed((idx, item) => idx) | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the interperter | |
e=(s,c)=>s/s?s:s.trim?c(s):(S=s[0],S=="if"?e(s[1],c)?e(s[2],c):e(s[3],c):S=="f"?a=>e(s[2],n=>s[1]==n?a:c(n)):e(S,c)(e(s[1],c))); | |
//global ctx | |
function global_scope(name){ | |
if(name === "log") | |
return item => console.log(item); | |
if(name === "+") | |
return a => b => a + b; | |
if(name === "<") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a basic 'scope' for our language... | |
// it will never have globals... | |
// so it will thorw by default. | |
function ctx(name){ | |
throw name + " is undefined"; | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log 'fixing keybindigs' | |
atom.keymaps.keyBindings.forEach (x) -> | |
if x.keystrokes == 'g ^' | |
x.keystrokes = 'g shift-6' | |
x.keystrokeArray = ['g', 'shift-6'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(into [] (partition-by #(not= % :spliter)) [1 2 3 4 :spliter 4 3 2 1 :spliter]) | |
;; ^^^^ this is like the base case. output is [[1 2 3 4] [:spliter] [4 3 2 1] [:spliter]] | |
(def in (chan)) | |
(def out (chan 1 (partition-by #(not= % :spliter)))) | |
(pipe in out) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns fizzbuzz.core) | |
(defn str-max [a b] | |
(if (<= (compare a b) 0) b a)) | |
(def fizzes (cycle ["" "" "fizz"])) | |
(def buzzes (cycle ["" "" "" "" "buzz"])) | |
(def numbers (sequence (comp (map inc) (map str)) (range))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns test.html | |
(:require [clojure.spec :as s] | |
[clojure.string :as string]) | |
(:require-macros [cljs.spec :as s])) | |
(def non-closing-elements | |
#{:area :base :br :col :command | |
:embed :hr :img :input :link | |
:meta :keygen :param :source | |
:track :wbr}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xrandr --newmode 1920x1080_60.00 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync | |
xrandr --addmode eDP1 1920x1080_60.00 | |
xrandr --output eDP1 --mode 1920x1080_60.00 --rate 60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
;; Layers you wish to have active | |
;; To get a list of all available layers, check github.com/dvcrn/proton/tree/master/src/cljs/proton/layers | |
:layers | |
[ | |
;; ----------------------------------- | |
;; core layer. Don't remove. | |
;; ----------------------------------- | |
:core |