Skip to content

Instantly share code, notes, and snippets.

@llacom
llacom / babashka-connect.el
Created February 4, 2021 09:49
emacs/cider commands to spawn a babashka repl and connect to it
(defun my-babashka-connect--process-filter (proc string)
"Run cider-connect once babashka nrepl server is ready."
(when (string-match "Started nREPL server at .+:\\([0-9]+\\)" string)
(cider-connect-clj (list :host "localhost" :port (match-string 1 string))))
;; Default behavior: write to process buffer
(internal-default-process-filter proc string))
(defun my-babashka-connect ()
"Start babashka on a random port."
(interactive)
@llacom
llacom / asd.py
Last active December 4, 2021 16:13
codingame cheat sheet
# We use ord() to get the ascii value of a given letter
s = "Hello"
numbers = [ord(c) for c in s] # => [72, 101, 108, 108, 111]
# And chr() for the letter associated to an ascii value
s2 = [chr(n) for n in numbers] # => ['H', 'e', 'l', 'l', 'o']
# Transform an array into a string:
@llacom
llacom / config.org
Created November 1, 2017 12:48
Emacs configuration as a single org-mode file

Initialisation

Custom file (load custom file)

(setq custom-file (concat user-emacs-directory "custom.el"))
(when (file-exists-p custom-file)
  (load custom-file))
// http://lisperator.net/blog/a-little-javascript-problem/
range = (start, end) => () => start <= end ? start++ : null;
foreach = (seq, fn) => { while (x = seq()) fn(x); };
map = (seq, fn) => () => (x = seq()) ? fn(x) : null;
reverse = (seq) => {
prev = null;
foreach(seq, (n) => {
let _prev = prev;

Initialisation

Custom file (load custom file)

(setq custom-file (concat user-emacs-directory "custom.el"))
(when (file-exists-p custom-file)
  (load custom-file))
workspace.clientAdded.connect(function(client) {
function fixdualscreen() {
if (workspace.numScreens === 1) return;
if (client.screen > 0) {
print("Client "+client.caption+" on external screen");
callDBus("org.fixscreen", "/org/fixscreen", "org.fixscreen", "setActivities", client.windowId, "");
client.onAllDesktops = true;
}
<!-- START POPUP -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="/jquery.cookie.js"></script>
<script>
function popunder(url, width, height, name_popunder) {
// On désactive le popunder sur les sites mobiles
if (typeof window.DetectMobileLong == 'function' && typeof window.DetectTierTablet == 'function') {
if(DetectMobileLong() || DetectTierTablet())
return false;
}