Skip to content

Instantly share code, notes, and snippets.

View matthijsgroen's full-sized avatar
🚀
Computering

Matthijs Groen matthijsgroen

🚀
Computering
View GitHub Profile
require "timeout"
module WaitSteps
extend RSpec::Matchers::DSL
matcher :become_true do
match do |block|
begin
Timeout.timeout(Capybara.default_wait_time) do
sleep(0.1) until value = block.call
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@matthijsgroen
matthijsgroen / jnk.rb
Created May 4, 2012 09:13
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
## keybindings
unbind C-b
unbind C-a
unbind %
unbind ,
unbind .
unbind n
unbind p
unbind [
unbind '"'
@matthijsgroen
matthijsgroen / fapi
Created February 29, 2012 14:52
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