Skip to content

Instantly share code, notes, and snippets.

View hauptbenutzer's full-sized avatar

Moritz Flucht hauptbenutzer

View GitHub Profile
@hauptbenutzer
hauptbenutzer / gist:72dd8b483f0886092106
Created March 26, 2015 18:03
WhatsApp Web Smiley Replacement
/**
* Simple script that replaces text smileys like ':)' with the corresponding
* emoji. Can be injected via Chrome Plugin 'Custom JavaScript', requires jQuery
* to be loaded along with it.
*/
/**
* Rangy, a cross-browser JavaScript range and selection library
* https://github.com/timdown/rangy
*

Keybase proof

I hereby claim:

  • I am hauptbenutzer on github.
  • I am flucht (https://keybase.io/flucht) on keybase.
  • I have a public key ASAFGSuRh7mrqwJ8ldYqSvVD9gF4UjCNLp8f1YxfHUqYsQo

To claim this, I am signing this object:

@hauptbenutzer
hauptbenutzer / verifiy_header.ex
Created November 25, 2018 07:33
Guardian VerifyHeader Wrapper
defmodule MyAppWeb.Guardian.VerifyHeader do
@moduledoc """
This is a wrapper for Guardian.Plug.VerifyHeader, the difference being that
we do not want the connection to be halted.
"""
@behaviour Plug
def init(opts), do: Guardian.Plug.VerifyHeader.init(opts)
def call(conn, opts) do
defmodule Roman do
defp num_lookup({0, _}), do: ""
defp num_lookup({1, 1}), do: "I"
defp num_lookup({5, 1}), do: "V"
defp num_lookup({1, 2}), do: "X"
defp num_lookup({5, 2}), do: "L"
defp num_lookup({1, 3}), do: "C"
defp num_lookup({5, 3}), do: "D"
defp num_lookup({1, 4}), do: "M"
@hauptbenutzer
hauptbenutzer / CodeMirror.vue
Created September 26, 2019 07:38
CodeMirror VueJS v-model binding
<template lang="html">
<div class="code-editor">
<textarea ref="textarea"/>
</div>
</template>
<script>
import CodeMirror from 'codemirror/lib/codemirror.js'
import 'codemirror/mode/htmlmixed/htmlmixed.js'
// You'll also want to include the css files