Skip to content

Instantly share code, notes, and snippets.

Stefan Wallin StefanWallin

Block or report user

Report or block StefanWallin

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
View anySuccessfulPromise.js
export default class AnySuccessfulPromise {
constructor(promises) {
this.promises = promises;
this.successes = [];
this.errors = [];
this.thenCallbacks = [];
this.catchCallback = () => {
console.error("catch not defined");
this.finallyCallbacks = [];
StefanWallin / anyPromise.js
Created Oct 4, 2018
A quick implementation of Promise.any that does not modify the Promise prototype
View anyPromise.js
class AnyPromise {
constructor(promises) {
this.promises = promises;
this.successes = [];
this.errors = [];
this.thenCallback = () => { console.error('then not defined'); };
this.catchCallback = () => { console.error('catch not defined'); };
this.finallyCallback = () => {};
StefanWallin /
Last active Jun 5, 2017
Swedens Regions with Municipalities 2017

Swedens Regions with Municipalities 2017


The hierarchic relation between regions(län) and municipalities(kommuner) represented as JSON. It's derived from the SCB(The Swedish Central Board of Statistics) XLS-file at as it existed on 2017-06-05.

Svenska (Swedish)

Den hierarkiska strukturen mellan län och kommuner representerad som JSON. Den är skapad utifrån SCB's XLS-fil på

StefanWallin / menu.html.erb
Created Dec 9, 2015
Recursive cells — is it possible?
View menu.html.erb
<%= render_cell(:menu, :show, { contents: @menu_content }) %>
View Post Upgrade to El Capitan, with Homebrew &

Post Upgrade to El Capitan, with Homebrew & Ruby

... and Xcode and Java, etc.


If you don't already have homebrew installed, do that first, so you don't have to deal with SIP issues. Install all Software Updates available in the Apple Menu, up to and including El Capitan.


StefanWallin / plugin_name.js
Created Oct 8, 2015
Javascript jQuery namespaced functionality nugget
View plugin_name.js
document.mittmedia = document.mittmedia || {};
(function(object, jQuery, ...dependencies...){
object.plugin_name = {
elements: {
init: function(){
gatherElements: function(){
View 20150903153455_add_flags_to_human.rb
class AddFlagsToHuman < ActiveRecord::Migration
def change
# Add the flags
add_column :humen, :signed_up, :boolean, default: false
add_column :humen, :welcome_email_sent, :boolean, default: false
# Set the flags values
reversible do |dir|
dir.up do do |human|
StefanWallin / mediaquery scss
Created Jun 14, 2015
Could this be done better? The media query is sooo out of place...
View mediaquery scss
#teamroster {
overflow: hidden;
@media (min-width: 600px) {
.team-display {
float: left;
overflow: hidden;
width: 30.3333333%;
margin-right: 1.5%;
min-width: 30%;
StefanWallin / 1. Error message
Last active Feb 24, 2016
Including static images in React Native not working :(
View 1. Error message
Requiring unknown module "image!backdrop". If you are sure the module is there, try restarting the packager.

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

You can’t perform that action at this time.