Skip to content

Instantly share code, notes, and snippets.

@bfabry
bfabry / gist:2946663
Created June 18, 2012 03:05
Spider all links in app using Capybara/Cucumber
module RSpec::Matchers
define :be_a_visitable_link_from do |page|
match do |page_link|
begin
page.visit(page_link[:href])
rescue Exception => e
@e = e
end
if @e || [500,404].include?(page.status_code)
def changes_scope(changes_before_num)
return @injected_versions_scope if @injected_versions_scope
if changes_before_num
Version.where('id > ?',changes_before_num).where(:item_type => 'UploadAttempt').order('id DESC')
else
Version.where(:item_type => 'UploadAttempt').order('id DESC')
end
end
#!/bin/bash
#xrdb -merge .Xresources
trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 15 --height 12 --transparent true --tint 0x000000 &
gnome-screensaver &
(ns predict-train-delays.twitter
(:use
[twitter.oauth]
[twitter.callbacks]
[twitter.callbacks.handlers]
[twitter.api.restful])
(:import
(twitter.callbacks.protocols SyncSingleCallback)))
(def my-creds (make-oauth-creds "nkjAm6lD6tpMwE6UeFw"
class Memoizer
def initialize(tgt)
@target = tgt
@cache = {}
end
def cache(*method_names)
method_names.each {|name| cache[name] = {} }
end
class ComposedCache
def initialize(target)
@target = target
end
def cache(*method_names)
method_names.each do |m|
original = @target.method(m)
results = {}
(ns going-native.core
(:import (com.sun.jna "Native"))
(:gen-class))
(gen-interface
:name jna.CLibrary
:extends [com.sun.jna.Library]
:methods [[printf [String] Integer]])
(def glibc (Native/loadLibrary "c" jna.CLibrary))
(defproject going-native "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:jvm-opts ["-Djava.library.path=/usr/share/java"]
:main going-native.core
:dependencies [[org.clojure/clojure "1.5.1"]
[net.java.dev.jna/jna "3.3.0"]])
module DataSource
module ConnectionProxies
class TeradataConnectionProxy < ConnectionProxy
def initialize(connection)
super(connection)
connection.class_eval do
@connection.class_eval do
def columns(*args)
binding.pry
#!/usr/bin/expect
spawn python3.2 [lindex $argv 0]
expect "mail"
send [email protected]\r
expect "assword"
send ASSSSSSSSS\r
interact