Skip to content

Instantly share code, notes, and snippets.

# A utility class with added behavior that it raises an exception if a key does not
# exist in hash.
module HashWithExceptionOnMissingKey
def self.new(hash)
obj = Hash.new do |hash, key|
raise ArgumentError, "Key #{key.inspect} does not exist in hash"
end
obj.merge!(hash)
end
@johanlunds
johanlunds / MainActivity.java
Created March 9, 2017 19:20
Mapbox Android SDK issue
package com.example.johan_lunds.mapboxissue;
import android.animation.ValueAnimator;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.animation.LinearInterpolator;
import com.mapbox.mapboxsdk.Mapbox;
@johanlunds
johanlunds / gist:2b73ca43180c79ea2f0b46c0555db5b4
Last active March 3, 2017 18:33 — forked from bregenspan/gist:5637609
Android Studio Logcat Filter to exclude spammy messages
^((?!wpa_supplicant|NetStatUtil).*)$
^((?!(?:dalvikvm|OpenGLRenderer)).)*$
# gem install benchmark-ips
require 'benchmark/ips'
require 'ruby-measurement'
require 'ruby-units'
Measurement.define(:tempC) do |unit|
unit.convert_to(:tempK) { |value| value + 273.15 }
end

Keybase proof

I hereby claim:

  • I am johanlunds on github.
  • I am johan_lunds (https://keybase.io/johan_lunds) on keybase.
  • I have a public key ASCozgDIwnpt-zOgZ1L5rP2TmXLz6t32z9sAeeuBs3Djhgo

To claim this, I am signing this object:

@johanlunds
johanlunds / mac apps.md
Last active September 5, 2015 11:56
My Mac apps

Replacements for Mac builtins:

  • Mailplane 3.app
  • Google Chrome.app

(Essential) productivity boosters:

  • 1Password 5.app
  • Alfred 2.app
  • Moom.app
depth=1 /C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
verify error:num=19:self signed certificate in certificate chain
verify return:0
56234:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:/SourceCache/OpenSSL098/OpenSSL098-52.20.2/src/ssl/s3_pkt.c:1145:SSL alert number 40
56234:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:/SourceCache/OpenSSL098/OpenSSL098-52.20.2/src/ssl/s23_lib.c:185:
CONNECTED(00000003)
depth=1 /C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
verify error:num=19:self signed certificate in certificate chain
verify return:0
CONNECTED(00000003)
---
Certificate chain
0 s:/C=SE/ST=Sweden/L=Stockholm/O=Stockholms Regiondjursjukhus/OU=Albano/CN=albano.lager.apoex.se
i:/C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
1 s:/C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
i:/C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
CONNECTED(00000003)
---
Certificate chain
0 s:/C=SE/ST=Sweden/L=Stockholm/O=Stockholms Regiondjursjukhus/OU=Albano/CN=albano.lager.apoex.se
i:/C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
1 s:/C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
i:/C=SE/ST=Stockholm/L=Stockholm/O=ApoEx/OU=Kundlager/CN=ApoEx/emailAddress=helpdesk@apoex.se
---
Server certificate
-----BEGIN CERTIFICATE-----
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form accept-charset="UTF-8" action="http://localhost:3000/care/session/login" class="form-login simple_form new_contact" id="new_contact" method="post">
<fieldset>
<span class="title"><img src="http://apoex.se/wp-content/themes/apoex/images/img-ico.png" width="16" height="18" alt="image description"> Logga in</span>
<div class="row control-group">