Skip to content

Instantly share code, notes, and snippets.

View flazz's full-sized avatar

Franco Lazzarino flazz

View GitHub Profile
;; i confirmed it by doing kill-word in M-x (it worked)
;; and i did it in eval (kill-word) and it failed as below
;;--
Debugger entered--Lisp error: (wrong-number-of-arguments #[(arg) "惁ࠀ瘀蠀怀尀∀蜀∀ 嬀愀爀最 欀椀氀氀ⴀ爀攀最椀漀渀崀 ㌀ ㄀㤀㠀㌀㜀㈀㈀ ∀瀀∀崀  ⤀ഀ  欀椀氀氀ⴀ眀漀爀搀⠀⤀
@flazz
flazz / symetric encryption.hs
Created April 22, 2009 05:56
denotational sematics
data Nibble a = Nibble a a a a deriving (Show, Eq)
op2 :: (a -> a -> a) -> Nibble a -> Nibble a -> Nibble a
op2 f (Nibble a b c d) (Nibble a' b' c' d') = Nibble (f a a') (f b b') (f c c') (f d d')
op1 :: (a -> a) -> Nibble a -> Nibble a
op1 f (Nibble a b c d) = Nibble (f a) (f b) (f c) (f d)
ror :: Nibble a -> Nibble a
ror (Nibble a b c d) = Nibble d a b c
-- Boolean XOR (NOT is defined in the system)
xor :: Bool -> Bool -> Bool
xor False False = False
xor False True = True
xor True False = True
xor True True = False
-- a 4-bit Boolean (that can be printed and tested for equality automagically)
data Nibble a = Nibble a a a a deriving (Show, Eq)
require 'app' # <-- your sinatra app
require 'spec'
require 'spec/interop/test'
require 'sinatra/test'
require 'cgi'
set :environment, :test
describe 'PiM validation' do
include Sinatra::Test
require 'describe'
require 'fileutils'
require 'spec'
require 'sinatra/test'
require 'spec/interop/test'
set :environment, :test
describe 'Describe Service' do
include Sinatra::Test
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://www.cise.ufl.edu/class/cop5555su09/class.notes.html'))
puts doc
puts '--'
doc.css('a').each do |l|
puts l.content
#!/usr/bin/ruby
LOG_DIR = "/var/log/daitss/ingest" || ENV['DAITSS_INGEST_LOG_DIR']
Dir.chdir LOG_DIR do
last_file = `ls -tr #{LOG_DIR} | tail -n 1`.chomp
open last_file do |io_potential|
loop do
@flazz
flazz / blog.rb
Created May 19, 2009 20:25 — forked from lenary/blog.rb
require 'sinatra'
class Blog < Sinatra::Default
get '/' do
..
end
end
if __FILE__ == $0
Blog.run!
end
gem 'rack-test', '~>0.3.0'
require 'rack/test'
gem 'webrat', '~>0.4.2'
require 'webrat/sinatra'
# path to schematron
$:.unshift File.join(File.dirname(__FILE__), '../../../schematron/lib')
$:.unshift File.dirname(__FILE__)
expected the following element's content to include "document is ill-formed":
document is well-formeddocument is valid (Spec::Expectations::ExpectationNotMetError)
./features/step_definitions/wellformedness_steps.rb:34:in `__instance_exec0'
./features/step_definitions/wellformedness_steps.rb:33:in `/^it should contain (no|some) formedness errors$/'
features/wellformedness.feature:8:in `And it should contain <quantity> formedness errors'