Skip to content

Instantly share code, notes, and snippets.

View jesperronn's full-sized avatar

Jesper Rønn-Jensen jesperronn

View GitHub Profile
@jesperronn
jesperronn / Gemfile
Created April 29, 2016 13:37
SuckerPunch for Rails (Rails 4.2). These are the only changes I needed to get started
# add this line to your `Gemfile`:
gem 'sucker_punch'
@jesperronn
jesperronn / Howto convert a PFX to a seperate .key & .crt file
Created April 15, 2016 12:46 — forked from TemporaryJam/Howto convert a PFX to a seperate .key & .crt file
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
{
"name": "angular2-webpack-starter",
"version": "3.0.0",
"dependencies": {
"abbrev": {
"version": "1.0.7",
"from": "abbrev@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz"
},
"accepts": {
@jesperronn
jesperronn / loading_spinner.coffee
Last active February 3, 2016 09:11 — forked from cpuguy83/loading_spinner.coffee
Simple loading spinner for long requests with turbolinks and bootstrap modal. This fork: HTML for Bootstrap 3.3.x
@PageSpinner =
spin: (ms=500)->
@spinner = setTimeout( (=> @add_spinner()), ms)
$(document).on 'page:change', =>
@remove_spinner()
spinner_html: '
<div class="modal hide fade" id="page-spinner" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
@jesperronn
jesperronn / Capfile
Created January 26, 2016 11:43 — forked from troelskn/Capfile
Sample cap setup
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
@jesperronn
jesperronn / js_toggle.coffee
Last active January 15, 2016 12:40
Generic checkbox toggle select all/none functionality
# Generic checkbox toggle select all/none functionality.
#
#
# Given the following checkbox:
# <input type="checkbox" class="js-toggle-all"
# data-target=".approved-count"
# data-count="#counter"
# data-total="#total">
#
# This checkbox kan toggle and count based on the selection of other checkboxes.
@jesperronn
jesperronn / strip_cpr_numbers.rb
Last active December 15, 2015 11:55
Danish CPR numbers: strip ssn dashes from numbers when saving, so that they are used consistently throughout the application
# 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
MIN_COUNT = 2
# 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
end
sum_up_a(0) # => 2
@jesperronn
jesperronn / docx2md.md
Last active May 22, 2025 20:00 — forked from aembleton/docx2md.md
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

<div id="remote">
<input class="typeahead" type="text" placeholder="Oscar winners for Best Picture">
</div>