Skip to content

Instantly share code, notes, and snippets.


Andre Foeken foeken

View GitHub Profile
foeken / roam.css
Created May 1, 2021
Zettelkasten CSS
View roam.css
//First the Better Roam Research with Custom font
@import url(';400;500;600;700;800&display=swap');
@import url("");
.level2 {
font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif !important; }
foeken / chinese-fix.js
Created Mar 13, 2021
Fix Chinese page creation in Roam Research
View chinese-fix.js
// Fix broken page creation for Chinese
document.addEventListener('input', function(e){
var elem =;
var pos = elem.selectionStart;
if (elem.nodeName != 'TEXTAREA' || != '【') return;
elem.value = elem.value.replace('【','[]');
elem.setSelectionRange(pos, pos);
foeken / encryptor.ex
Created Sep 13, 2018
ActiveSupport MessageEncryptor Elixir HMAC ExCrypto
View encryptor.ex
defmodule ActiveSupportMessageEncryptor do
def encrypt(map, key) do
clear_text = Poison.encode!(map)
{:ok, aes_256_key} = Base.decode64(key)
{:ok, {iv, cipher_text}} = ExCrypto.encrypt(aes_256_key, clear_text)
payload = [cipher_text, iv] |> x -> Base.encode64(x) end) |> Enum.join("--") |> Base.encode64()
digest = :crypto.hmac(:sha, aes_256_key, payload) |> Base.encode16(case: :lower)
[payload, digest] |> Enum.join("--")

Multi tenant Elixir / Phoenix

I'm starting to use Elixir and Phoenix. I want to use a multi-tenant database setup like the Apartment gem provides for Rails apps.

The core setup is this:

  • Request comes in from specific subdomain
  • Translate subdomain to specific tenant database
  • Set the database to the tenant database
foeken / content.js
Last active May 23, 2016
Crude Google Chrome Ninchanese extension
View content.js
function getImageUrl(searchTerm, callback, errorCallback) {
var api_key = 'XXX'; // NOTE, the API is limited so you need a personal API key and Custom Search Engine ID
var cx_key = 'XXX'; // SEE:
var searchUrl = '' + encodeURIComponent(searchTerm) + '&cx='+ cx_key +'&safe=high&searchType=image&key=' + api_key
var x = new XMLHttpRequest();'GET', searchUrl);
x.responseType = 'json';
x.onload = function() {
foeken / gist:f44e948bbc180fbdf3a5
Created Mar 13, 2016
font-color does not work
View gist:f44e948bbc180fbdf3a5
paragraph-divider {
font-color: $light-grey
margin-top: 12pt
margin-bottom: 12pt
text-alignment: center
content: "• • •"
foeken / gist:018bbb5c1e482a9cf95b
Created Sep 30, 2014
A crude Github - Zendesk syncer
View gist:018bbb5c1e482a9cf95b
class Zendesk
ENDPOINT = "https://[DOMAIN]"
BODY_FIELD_ID = 0 # [CUSTOM_BODY_FIELD_ID], We use an internal body
REPO_NAME_FIELD_ID = 0 #[REPO_NAME_FIELD_ID], We use a selectbox
GITHUB_FIELD_ID = 0 #[GITHUB_FIELD_ID], We use a checkbox
View gist:d4b4e207fda19abb9614
// Hack the 1password extention on OSX:
// Locate: /Users/[USERNAME]/Library/Application Support/Google/Chrome/Default/Extensions/aomjjhallfgjeglblehebfpbcfeobpgk
// Add this to global.min.js, look for var Ka = [{template},{template},{template}]
template_for: [/:\/\/mijn\.ing\.nl\//],
hints: [
["input[type=text]", "username"],
["input[type=password]", "password"]
foeken /
Created Mar 15, 2014
Keybase Proof

Keybase proof

I hereby claim:

  • I am foeken on github.
  • I am dreetje ( on keybase.
  • I have a public key whose fingerprint is 7DC5 D6AA 64D6 6CF1 FF9E 0686 65BB 0DBC E7CE 60FE

To claim this, I am signing this object:

foeken / gist:4160705
Created Nov 28, 2012
RubyMotion Bug in Module ordering
View gist:4160705
# Take the following setup, this works if everything is inside a single file.
# app/foo/monkey.rb
module Foo
module Monkey
puts "Monkey"
# app/foo/nut.rb