Skip to content

Instantly share code, notes, and snippets.

@auramo
auramo / figwheel-emacs-cider.txt
Created August 6, 2015 12:35
figwheel emacs cider stuff
## Using Emacs CIDER as the Figwheel REPL tool
project.clj should have this line:
```
:figwheel { :nrepl-port 7888 }
```
At the defproject-level.
It enables external tools to connect to the Figwheel REPL. To connect
@auramo
auramo / body_count.py
Created March 27, 2020 19:56
Jenkkien ruumiit pääsiäiseks
days = 16
current_body_count = 400
body_count = current_body_count
for d in range(1, days+1):
if d % 3 == 0:
body_count = body_count * 2
print("body count: ", body_count)
@auramo
auramo / prettier-idea.md
Created May 17, 2018 17:37
Prettier IDEAan

Add prettier to Intellij IDEA

npm install -g prettier
which prettier

-> ^ remember the path

IDEA: settings -> external tools -> add new

const password = 'kuikka'
const keyIv = cryptoUtils.deriveAES256KeyAndIv(password.replace(/\s/g, ''))
const maxFileSize = 2 * 1024 * 1024 * 1024
const isMeb = fileName => /\.meb$/.test(fileName)
const isZip = fileName => isMeb(fileName) || /\.zip$/.test(fileName)
const isEncryptedZip = fileName => /\.zip\.bin$/.test(fileName)
const isEncryptedJson = fileName => /\.json\.bin$/.test(fileName)
const readZipContents = (zipFileName, zipContents) => {
@auramo
auramo / gist:a2e515973b4168396dd1
Last active March 15, 2017 11:03
ClojureScript Protocol and Deftype View example
(defprotocol View
"View abstraction"
(render [this some-param] "Renders view")
(destroy [_] "Destroys view, runs cleanup"))
(deftype ProjectView [data]
View
(render [this some-param] [:h1 (str "Hello " (:name data) " some param we passed in " some-param)])
(destroy [_] (println "Cleaning up")))
@auramo
auramo / gist:0fd4a3a2cc145009411abf5805e732cc
Created May 11, 2016 12:45
Yegge for the lack of a nail
For the lack of a nail,
throw new HorseshoeNailNotFoundException("no nails!");
For the lack of a horseshoe,
EquestrianDoctor.getLocalInstance().getHorseDispatcher().shoot();
For the lack of a horse,
RidersGuild.getRiderNotificationSubscriberList().getBroadcaster().run(
new BroadcastMessage(StableFactory.getNullHorseInstance()));
@auramo
auramo / Scala Option handling
Last active April 7, 2016 06:47
Examples on how Option is handled neatly
// Map and flatMap for Options/Lists
scala> val myList : List[Option[Int]] = List(Some(1), None, Some(2))
myList: List[Option[Int]] = List(Some(1), None, Some(2))
scala> myList.flatten.map(x=>x*2)
res15: List[Int] = List(2, 4)
scala> myList.flatMap((x) => x.map(_*2))
res16: List[Int] = List(2, 4)
@auramo
auramo / gist:76a9cfaa85eabd0eb1b9
Created March 16, 2016 17:32
node static server
var express = require('express');
var app = express();
app.use(express.static('public'));
app.listen(8000, function () {
console.log('Example app listening on port 8000!');
});
@auramo
auramo / gist:74a9f0c106692921c8ac
Created March 8, 2016 11:40
Just store this under /etc/systemd/system/mailcatcher.service
[Unit]
Description=Mailcatcher service
After=network.target
[Service]
WorkingDirectory=/opt/node/apps/hela-webapp
ExecStart=/usr/local/bin/mailcatcher -f --smtp-port 2155 --http-ip=0.0.0.0 --http-port 8181 --smtp-ip=0.0.0.0
Restart=always
StandardOutput=syslog
StandardError=syslog
@auramo
auramo / gist:8347434
Created January 10, 2014 05:31
Command line flags for bash
#!/bin/bash
set -e
command="$1"
eka() {
local use_x_flag=false
while getopts ":x:" o; do
case "${o}" in