Skip to content

Instantly share code, notes, and snippets.

View rwoeber's full-sized avatar

Richard Wöber rwoeber

  • Würzburg, Germany
View GitHub Profile
@rwoeber
rwoeber / get_latest_release.sh
Created April 3, 2021 18:22 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@rwoeber
rwoeber / destructuring.md
Created December 10, 2018 14:44 — forked from yang-wei/destructuring.md
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@rwoeber
rwoeber / menu.html
Created March 16, 2016 12:12 — forked from jgoyon/menu.html
Horizontal menu, full width sub menu
<div id="menu">
<ul id="nav">
<li><a href="#">Menu 1</a>
<ul>
<li><a href="#">Menu 1 Submenu item 1</a></li>
<li><a href="#">Menu 1 Submenu item 2</a></li>
<li><a href="#">Menu 1 Submenu item 3</a></li>
</ul>
</li>
@rwoeber
rwoeber / .latexmkrc
Last active February 25, 2016 07:15 — forked from davegurnell/.latexmkrc
Sample latexmk file to provide continuous compilation and preview with MacTex on OS X
# Sample latexmk configuration to use xelatex and Preview on OS X.
# Should help if you want to use latexmk with MacTeX.
#
# 1. Install MacTeX
# 2. Put this file in ~/.latexmkrc
# 3. Continuously recompile and preview your document with the command:
# latexmk -pvc myfile.tex
$pdflatex = 'xelatex -interaction=nonstopmode %O %S';
$pdf_previewer = 'open -a Preview "%S"';
@rwoeber
rwoeber / mix.exs
Created January 16, 2016 15:56 — forked from jeffweiss/mix.exs
Retrieving application version number in mix.exs from git describe
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[app: :my_app,
version: get_version,
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: Mix.compilers,
build_embedded: Mix.env == :prod,
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@rwoeber
rwoeber / log.txt
Last active August 29, 2015 14:06 — forked from steveklabnik/log.txt
$ history | awk {'print $2, $3, $4'} | sort | uniq -c | sort -k1 -rn | head -n 30
610 git status
568 git commit -m
491 git add .
252 git push origin
176 bundle
138 rails s
128 ls
120 git commit --amend
114 git reset --hard
@rwoeber
rwoeber / maven.plugin.zsh
Last active August 13, 2019 12:01 — forked from evelyne24/README
oh-my-zsh Plugin to colorize Maven. Put in `${OH_MY_ZSH_HOME}/custom/plugins/maven` and add to plugins array in `.zshrc`
# Original from https://gist.github.com/evelyne24/7714094
# Notes
# In MacOS, + does not work for regex, nor -E flag.
# Instead I used \{1,\} for char repetition.
# Formatting constants
bold=`tput bold`
red=`tput setaf 1`
bg_red=`tput setab 1`
green=`tput setaf 2`
radians = (n) ->
n * (Math.PI / 180)
# Operates similarly to Ruby's `Enumerable.invoke`
invoke = (a, f) ->
for n in a
memo = f memo, n
memo
# Returns the sum of an array of numeric items
@rwoeber
rwoeber / benchmark
Created February 20, 2013 20:49 — forked from danneu/benchmark
# I'm no benchmark guru. Just did a bunch of:
$ time ruby <filename>
# Note: This is just an 80mb XML file with 38,000 nodes.
ox_dom.rb 4.56s user 0.78s system 93% cpu 5.714 total (550mb)
ox_dom.rb 4.58s user 0.79s system 87% cpu 6.126 total (550mb)
ox_dom.rb 4.60s user 0.80s system 87% cpu 6.140 total (550mb)
nokigiri_dom.rb 11.75s user 1.02s system 94% cpu 13.518 total (895mb)
nokigiri_dom.rb 11.36s user 1.02s system 93% cpu 13.211 total (895mb)