Skip to content

Instantly share code, notes, and snippets.

View jewilmeer's full-sized avatar
🚀

Jan-Willem van der Meer jewilmeer

🚀
  • jewilmeer
  • Utrecht, The Netherlands
  • 17:15 (UTC +02:00)
View GitHub Profile
{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"drawWhiteSpace": true,
"folder_exclude_patterns":
[
".svn",
".git",
"tmp/cache"
],
"font_size": 12.0,
#!/bin/sh
#
# Git pre-commit hook to keep you from shooting yourself in the foot by testing
# for common mistakes and errors.
#
# Installation:
#
# 1. Copy this file into your Git hooks directory (i.e. ./.git/hooks).
# 2. Make it executable: chmod +x .git/hooks/pre-commit

Keybase proof

I hereby claim:

  • I am jewilmeer on github.
  • I am jewilmeer (https://keybase.io/jewilmeer) on keybase.
  • I have a public key whose fingerprint is A04C 2F2A BCCE 73B5 F450 E84F 1BC3 D22D A3EC 449A

To claim this, I am signing this object:

@jewilmeer
jewilmeer / gist:860988
Created March 8, 2011 20:37
parse xml file
require 'net/http'
html = Net::HTTP.get(URI.parse('http://www.w3schools.com/XML/note.xml'))
hash = Hash.from_xml( html )
puts html.inspect
puts hash.inspect
@jewilmeer
jewilmeer / gist:980626
Created May 19, 2011 12:27
lambda caching
class Episode < ActiveRecord::Base
scope :airs_at_in_future, lambda{ where('episodes.airs_at > ?', Time.zone.now) }
scope :airs_at_in_past, lambda{ where('episodes.airs_at < ?', Time.zone.now) }
# will cache Time.now
scope :next_airing, airs_at_in_future.order('episodes.airs_at asc')
scope :last_aired, airs_at_in_past.order('episodes.airs_at desc')
# will not cache Time.now
scope :next_airing, lambda{ airs_at_in_future.order('episodes.airs_at asc') }
<div class="container">
<div class="span4"></div>
<div class="span8">
<div class="row">
<div class="span2">sidebar</div>
<div class="span9">main</div>
</div>
</div>
</div>
@jewilmeer
jewilmeer / keybase.md
Last active September 30, 2015 16:31
keybase.md

Keybase proof

I hereby claim:

  • I am jewilmeer on github.
  • I am jewilmeer (https://keybase.io/jewilmeer) on keybase.
  • I have a public key whose fingerprint is DFC5 2B60 F3C8 75AB 9D89 74FC 93F0 49A2 E61D 112B

To claim this, I am signing this object:

@jewilmeer
jewilmeer / fapi
Created March 5, 2012 15:33 — forked from matthijsgroen/fapi
Fapi
#!/usr/bin/ruby
require 'net/http'
require 'net/https'
require 'base64'
require 'uri'
require 'yaml'
require 'cgi'
class Net::HTTP
alias_method :old_initialize, :initialize
@jewilmeer
jewilmeer / jnk.rb
Created May 29, 2012 07:20 — forked from matthijsgroen/jnk.rb
Jenkins command line
#!/usr/bin/ruby
require 'net/http'
require 'net/https'
require 'base64'
require 'uri'
require 'yaml'
require 'cgi'
module Configuration
def config_file
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.define :gitlab do |gitlab|
gitlab.vm.network :hostonly, "10.10.10.100"
gitlab.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]