Skip to content

Instantly share code, notes, and snippets.

View marten's full-sized avatar

Marten Veldthuis marten

View GitHub Profile
Bundle 'The-NERD-tree'
nmap <leader>n :NERDTreeClose<CR>:NERDTreeToggle<CR>
nmap <leader>N :NERDTreeClose<CR>
let NERDTreeBookmarksFile=expand("$HOME/.vim/NERDTreeBookmarks") " Store the bookmarks file
let NERDTreeShowBookmarks=1 " Show the bookmarks table on startup
let NERDTreeShowFiles=1 " Show hidden files, too
let NERDTreeShowHidden=1
let NERDTreeQuitOnOpen=0 " Don't quit on opening files from the tree
let NERDTreeHighlightCursorline=1 " Highlight the selected entry in the tree
namespace :notify do
task :airbrake do
# We need to do this require here, becaure Airbrake will load up ActiveSupport,
# which will set up Kernel#capture, which will fudge up capistrano's capture method.
# If we do the require here (just-in-time) and just HOPE that nobody after
# us needs capture, we might be ok.
#
# Yeah, really.
require 'airbrake'
require 'airbrake_tasks'
@Devtool = new Backbone.Marionette.Application
Devtool.module 'Models'
Devtool.module 'Collections'
Devtool.module 'Views'
Devtool.module 'Controllers'
Devtool.module 'Routers'
Backbone.Marionette.Renderer.render = (template, data) ->
if !JST[template]
import os
def writefile(name, contents):
directory = os.path.dirname(os.path.realpath(__file__))
filename = os.path.join(directory, "%s.py" % name)
with open(filename, "a") as openfile:
openfile.write(contents)
print 'done'
import threading
import time
class ReadoutSession:
def run(self):
# doe trage dingen, zoals
print "HOI"
time.sleep(5)
print "DOEI"
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" }
@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:

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
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|
### 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: