Skip to content

Instantly share code, notes, and snippets.

@floscr
floscr / remove-duplicate-lines-from-a-selection.org
Last active July 10, 2019 13:31
Remove duplicate lines from a selection

Remove duplicate lines from a selection

Edit: Turns out there’s a shorter way: :%!sort | uniq 💫

Manual Way

Say you have want this text sorted and only with unique lines.

@floscr
floscr / sorting-lines-by-regexp.org
Created May 29, 2019 16:05
Sorting Lines by Regexp

Sorting Lines by regexp

Say you have the code, andd you want to sort by the key

(map! :leader (:desc "Notes" :prefix "n"
                :desc "Pinboard File"        :n "B" (λ! (find-file org-pinboard-file))
                :desc "Reading List"         :n "r" #'+org|org-open-reading-list-file
                :desc "Home"                 :n "h" #'+org|org-open-home-file
;;; ~/.homesick/repos/Dotfiles/home/.config/doom/+spell.el -*- lexical-binding: t; -*-
(after! flyspell
(cond
((executable-find "hunspell")
;; For the switching, "german" has to be also in this alist
(add-to-list 'ispell-hunspell-dict-paths-alist (list "german" (expand-file-name "~/Library/Spelling/de_AT.aff")))
(setq ispell-program-name "hunspell"
@floscr
floscr / org-element-map.el
Created December 7, 2018 18:29
Org element map not working?
(defun +org|org-src-block-refmt-reason-ocaml-toggle ()
"Convert the current src block from ocaml to reason and vice versa"
(interactive)
(org-element-map (org-element-at-point) 'src-block
(lambda (b)
(org-element-put-property b :language "test"))))
@floscr
floscr / talking-emoji.js
Created December 15, 2017 17:22
Talking emoji
// Stolen from https://twitter.com/aemkei/status/941410298388537346
setInterval(_=>{
document.body.innerHTML = "<h1>" + [
..."😮😀😁😐😑😬"
][new Date%6]
}, 99)
@floscr
floscr / talking-emoji.js
Created December 15, 2017 17:22
Talking emoji
setInterval(_=>{
document.body.innerHTML = "<h1>" + [
..."😮😀😁😐😑😬"
][new Date%6]
}, 99)
@floscr
floscr / create-mardown-list-from-mjam.js
Last active December 5, 2017 12:29
Create a markdown todo list from a mjam order receipt
(function() {
const $ = document.querySelectorAll.bind(document)
const textContentFromDomQuery = query => [...$(query)].map(x => x.textContent)
const names = textContentFromDomQuery('.Cart__Name')
const prices = textContentFromDomQuery('.is-sum > .is-value')
const pairs = names
.map((x,i) => {
const name = x
@floscr
floscr / setup-elixir-phoenix.sh
Last active November 13, 2017 18:48
Setup Elixir + Phoenix
# Install Elixir + Phoenix + Erlang
brew install elixir
mix local.hex
brew install erlang
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
# Install PostgreSQL
brew install postgresql
initdb /usr/local/var/postgres -E utf8
@floscr
floscr / haskell-setup-osx.md
Last active August 13, 2017 17:04
Haskell Setup OSX
brew install ghc cabal-install

stack new my-project
stack setup --install-ghc
stack install ghc-mod
@floscr
floscr / generate-multi-size-assets
Created April 13, 2017 09:20
Photoshop Generate @1x, @2x assets from one @2x PSD
# Rename your layer to this:
filename-2x.png, 50% filename-1x.png