Skip to content

Instantly share code, notes, and snippets.

View marten's full-sized avatar

Marten Veldthuis marten

  • RoQua, UMCG
  • Beilen, Netherlands
View GitHub Profile
@marten
marten / deploy.rb
Created November 13, 2014 10:26
Capistrano Flowdock integration
set :format, :capture
# rest of your deploy.rb goes here
after 'deploy:started', 'notify:flowdock:started' do
$flowdock_deploy_thread = Deployer::Flowdock::Deployment.new(application: fetch(:application),
environment: fetch(:rails_env) || fetch(:rack_env),
repo_name: fetch(:repo_url).gsub(/\Agit@github.com:(.*).git/, "\\1"),
source 'https://rubygems.org'
gem 'sqlite3'
gem 'rspec', '2.14'
gem 'activerecord'
import subprocess
import sys
import time
proc = subprocess.Popen(['/Users/marten/.rubies/ruby-2.1.1/bin/ruby', '/Users/marten/tmp/python-processes/slave.rb'],
stdin=subprocess.PIPE, stdout=sys.stdout)
for i in range(5):
print "Python preparing to send newline"
proc.stdin.write("\n")
class BalancerState
InvalidStatus = Class.new(StandardError)
def initialize(disk_access = File)
@disk_access = disk_access
end
def call(env)
if balancer_member?
[200, {'Content-Type' => 'application/json'}, ['{"status": "ok", "member": true}']]
### Keybase proof
I hereby claim:
* I am marten on github.
* I am marten (https://keybase.io/marten) on keybase.
* I have a public key whose fingerprint is BEFE 8DE2 290F EE5C CA5C 3C09 58CC FD07 03C0 DA07
To claim this, I am signing this object:
class OldInvitationsToFillOutTasks < ActiveRecord::Migration
include Roqua::Logging
def up
Invitation.where(active: true, completed: false, is_template: false)
.includes(:questionnaires)
.includes(:meas_instance)
.includes(:patient)
.includes(:team)
.find_each do |invitation|
line = (<<-END).strip.chars.to_a
'"'hello world"\\", he" said, whil'e \\opening\\' "the door"
END
elements = [""]
mode = nil
while char = line.shift
puts char
case mode
@marten
marten / backend.md
Last active December 23, 2015 00:49

Let's assume some basic AR stuff:

class Invitation < ActiveRecord::Base
  scope :templates, where(template: true)
end

Then we could set up some Pavlov operations, one interactor and some queries and commands:

spork_options = {:rspec_env => { 'RAILS_ENV' => 'test' }, :wait => 60, :cucumber => false, :test_unit => false, :rspec_port => 8910 }
rspec_options = {:keep_failed => false, :all_after_pass => false, :all_on_start => false, :cli => "--drb --drb-port 8910 -f Fuubar --colour"}
teabag_options = {:keep_failed => false, :all_after_pass => false, :all_on_start => false}
def self.rspec_tests!(rspec_options)
guard :rspec, rspec_options do
# Rails example
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
import threading
import time
class ReadoutSession:
def run(self):
# doe trage dingen, zoals
print "HOI"
time.sleep(5)
print "DOEI"