Skip to content

Instantly share code, notes, and snippets.

Avatar
🌈
It's complicated?

Ryan Davis zenspider

🌈
It's complicated?
View GitHub Profile
@zenspider
zenspider / some_case.rb
Last active Aug 28, 2016 — forked from riseshia/some_case.rb
simple example
View some_case.rb
class Task
attr_accessor :done_flg
def done?
done_flg
end
end
class Minitest::Test
def self.test name, &body
View Dir.pwd
require 'singleton'
class TestIO
include Singleton
self.instance
def self.pwd
print Dir.pwd
end
View test_helper.rb
require 'test/unit'
# or
# require "minitest"
# require "minitest/autorun"
class Test::Unit::TestCase
# or, for Minitest, do:
# class Minitest::Test
def self.testing(name)
View Rakefile
# Rakefile
require 'rake/testtask'
Rake::TestTask.new do |t|
t.test_files = Dir['test_*.rb']
end
task :default => :test
View transactional_test.rb
require "minitest/autorun"
class TransactionalTest < Minitest::Test
def run
DB.transaction(savepoint: true, rollback: :always) do
super
end
self
end
View sausage.scm
(use posix)
(define (make-serialport file)
(let ((fileno
(file-open
file
(bitwise-ior open/rdwr open/noctty open/nonblock))))
; Enable blocking reads on the FD
(let ((current-fl (file-control fileno fcntl/getfl 0)))
@zenspider
zenspider / gist:1119075
Created Aug 1, 2011 — forked from deanh/gist:1112154
Get some jamz
View gist:1119075
#!/bin/bash
PARTY_DIR=subpop_cascadia
command -v curl || (echo "No curl in path." && exit 1)
mkdir -p $PARTY_DIR
cd $PARTY_DIR
curl https://s3.amazonaws.com/subpop-public/assets/audio/JAMIFEST.txt | sort -n | xargs -P 4 -n 1 curl -O
@zenspider
zenspider / register.rb
Created Jul 31, 2011 — forked from postmodern/register.rb
not hard and not terribly useful.
View register.rb
#!/usr/bin/ruby -w
require 'rubygems'
require 'minitest/autorun'
# From: http://rubylearning.com/blog/2011/07/28/how-do-i-test-my-code-with-minitest/
class CashRegister
attr_reader :items
You can’t perform that action at this time.