Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / Liquid Democracy
Created December 22, 2015 19:28
Created using soleditor: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity?gist=
/*
Liquid Democracy
Uses a token as voting weight, you can delegate that weight to anyone as your representative.
They can also delegate to other people, and this cycles until someone with more votes is apointed.
The person with more votes gets to execute any transaction in this contract's name.
Useful if the liquid democracy is set as `owner` of some other contract.
*/
@brb
brb / prepare-commit-msg
Created August 1, 2013 08:25
Git hook for appending an issue id into commit messages. The issue id is taken from branch name which should be in a "foobar-ISSUE-ID" format.
#!/bin/bash
regexp=".*-([A-Z].*-[0-9]*)"
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
if [[ "$branch" =~ $regexp ]]; then
refs_id=${BASH_REMATCH[1]}
if [ "$2" = message ]; then
echo -ne "\n${refs_id}" >> "$1"
else
sed -i "1s/^$/\n\n${refs_id}/g" "$1"