Skip to content

Instantly share code, notes, and snippets.

View hidde-jan's full-sized avatar

Hidde-Jan Jongsma hidde-jan

View GitHub Profile
begin
require 'bundler/inline'
rescue LoadError => e
STDERR.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
@hidde-jan
hidde-jan / keybase.md
Last active June 17, 2020 07:47
keybase.md

Keybase proof

I hereby claim:

  • I am hidde-jan on github.
  • I am hiddejan (https://keybase.io/hiddejan) on keybase.
  • I have a public key ASBXijiDtzCGrZn_G3hpJYy8JD0WhlRrqTXs_iAjZbvdDQo

To claim this, I am signing this object:

@hidde-jan
hidde-jan / easygplot.m
Last active December 24, 2015 11:38
Some quick 'n dirty matlab functions for working with graphs and their important matrices.
function easygplot( A )
%EASYGPLOT What gplot should do by default.
% EASYGPLOT puts all nodes on a circle equidistantly starting at (1, 0)
% and going counter clockwise. 2-way edges are plotted in black, edges
% from node i to node j with i < j are plotted in blue, and edges from
% node j to i with j > i are plotted in red.
%
% It's assumed that A(i,j) = 1 if there is an edge from j into i, and
% A(i,j) is zero otherwise.
@hidde-jan
hidde-jan / test.rb
Created August 13, 2013 15:09
Test case for order bug
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
@hidde-jan
hidde-jan / solveportfolio.m
Created March 1, 2012 20:48
Solve the portfolio QD problem using solvesdp and SeDuMi solver
function [ opt, x_opt, diagnostics ] = solveportfolio( C, r, alpha )
%SOLVEPORTFOLIO Solve the portfolio problem.
% Minizing the risk for investing in `n` different opportunities, while
% keeping the expected return on investment above `alpha`.
%
% This solves the following QD:
%
% min x' C x
%
% st. sum(x) = 1
@hidde-jan
hidde-jan / log_level_debug.txt
Created October 11, 2011 22:39
Vagrant up error
[default] Importing base box 'lucid32'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 4.0.2
VirtualBox Version: 4.1.4
[default] Matching MAC address for NAT networking...
@hidde-jan
hidde-jan / form.html.erb
Created July 15, 2011 15:24
I18n definition, no translated labels
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
@hidde-jan
hidde-jan / namespaced_app_directories.py
Created March 15, 2011 21:52
Django template loader that allows for `namespaced` loading of templates.
"""
Wrapper for loading templates from "templates" directories in INSTALLED_APPS
packages, prefixed by the appname for namespacing.
This loader finds `appname/templates/index.html` when looking for something
of the form `appname/index.html`.
"""
from django.template import TemplateDoesNotExist
from django.template.loaders.app_directories import app_template_dirs, Loader as BaseAppLoader