Skip to content

Instantly share code, notes, and snippets.

Jesper Rønn-Jensen jesperronn

Block or report user

Report or block jesperronn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jesperronn / strip_cpr_numbers.rb
Last active Dec 15, 2015
Danish CPR numbers: strip ssn dashes from numbers when saving, so that they are used consistently throughout the application
View strip_cpr_numbers.rb
# Formatting and validation of Danish CPR number
# when saving we will throw away the dash "-" in the SSN and show it when retrieving
# Custom retrieval of formatted value: This is done by the method
# `formatted_cpr`. Use that in your views if you need it
# or in extreme cases you can override the getter method and call `formatted_cpr`
# Strategies for saving of unformatted value:
# 1. use either `base.after_validation` to hook into callbacks. This is a little annoying
View fill_up_to.rb
# Naïve implementation, just return whatever number I need
def sum_up_a(existing)
return 2 if existing == 0
return 1 if existing == 1
return 0
sum_up_a(0) # => 2
jesperronn /
Last active Oct 23, 2019 — forked from aembleton/
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution

View remote.html
<div id="remote">
<input class="typeahead" type="text" placeholder="Oscar winners for Best Picture">
View .simplecov
# save to CircleCI's artifacts directory if we're on CircleCI
# see
dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
require 'simplecov-csv'
#!/usr/bin/env bash
BASEDIR=$(dirname $0)
# step "Remounting / and /boot as read-write:"
# try mount -o remount,rw /
# try mount -o remount,rw /boot
# next
# usecases:
jesperronn /
Created Apr 15, 2015
SVN manipulate history
#!/usr/bin/env bash
# set -x
# script here will create new subversion repository (file based).
# then it will make 10 commits
# Then we will manipulate the commit dates of the ten commits
View index.html
<!DOCTYPE html>
<script src=""></script>
<meta charset="utf-8">
<title>JS Bin</title>
#before, #after {display: none;}
<style id="jsbin-css">
jesperronn / git filter-branch
Created Jan 21, 2015
git filter-branch author EMAIL
View git filter-branch
git filter-branch --env-filter '
> then
> if [[ "$GIT_AUTHOR_NAME" = "Ben Alman" ]]
> then
> GIT_AUTHOR_NAME="Jesper Rønn-Jensen"
> GIT_COMMITTER_NAME="Jesper Rønn-Jensen"
# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to make opened Markdown files always be soft wrapped:
# path = require 'path'
You can’t perform that action at this time.