Skip to content

Instantly share code, notes, and snippets.

View thhermansen's full-sized avatar

Thorbjørn Hermansen thhermansen

View GitHub Profile
http://ew2d.t.proxylocal.com/orderings/third_parties/dnb?web_order[id]=6401012&web_order[broker][id]=mabj&web_order[broker][email]=magnus.bjork%40DNBeiendom.no&web_order[broker][name]=Magnus%20Bj%C3%B6rk&web_order[broker][mobile]=&web_order[broker][telephone]=&web_order[office][id]=103&web_order[type]=residential&web_order[estate_address][street]=Djupedalsfaret+56+B&web_order[estate_address][zip_code]=3280&web_order[estate_address][postal_area]=TJODALYNG&web_order[estate_seller][name]=Marit%20Schulstok&web_order[estate_seller][telephone]=99%2001%2062%2092&web_order[estate_seller][mobile]=99%2001%2062%2092&web_order[estate_seller][email]=&api_key=3e86fde49f703c658dc4bcccc9627e85&signature=ced0e1b974e9b69ff8ab53d477b5daaeeca0cfb8e7dd606f9229d7e136218541&ts=1336734870&third_party_application_name=DNB%22%20for%20153.110.137.24%20at%202012-05-11%2010:14:32%20+0000[28967]:%20Started%20GET%20%22/orderings/third_parties/dnb?web_order[id]=6401012&web_order[broker][id]=mabj&web_order[broker][email]=magnus.bjork%40DNBei
@thhermansen
thhermansen / third_party.xml
Created April 17, 2012 18:02
WebOrder data third party
<?xml version="1.0" encoding="UTF-8"?>
<web-order>
<id>1</id>
<customer-ref>customer_ref_1</customer-ref>
<web-order-type>residential</web-order-type>
<office>
<id>99</id>
<name>Asker eiendomsmegling</name>
</office>
@thhermansen
thhermansen / order_export_request.xml
Last active September 30, 2015 05:28
Order Export
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://users.example.com">
<env:Body>
<order>
<!--
The total amount can be used to verify that
sums calculated by Thalamus and NAV are in sync
-->
<totalAmount>21.0</totalAmount>
@thhermansen
thhermansen / base.rb
Created September 7, 2011 16:48
ORM base class simplified
class Base
end
@thhermansen
thhermansen / sunspot.rb
Created June 5, 2011 11:04
Sunspot rspec helper file
#
# Put this in spec/support/
# Will use a sunspot stub session as default in all tests.
#
# To actually test the search you'll need something like:
# describe "something", sunspot: true do
# ...some tests...
# end
#
# If you do this in your spec helper:
@thhermansen
thhermansen / car.rb
Created June 5, 2011 10:38
Hbase site configuration file
class Car < MassiveRecord::ORM::Table
# Defines a column family "info" where two fields are stored.
# By default fields will be strings, but you can send in a type
# As a second option, for instance :integer, :boolean and so on.
# You can also set a default value, and say that a field can't be nil or not.
# For more information, see MassiveRecord's github page.
column_family :info do
field :brand
field :color
end
@thhermansen
thhermansen / devise_orm_massive_record.rb
Created May 28, 2011 19:31
Give Devise support for MassiveRecord
#
# lib/devise/orm/massive_record.rb
#
# This adds support for Devise so Devise can define
# attributes in a MassiveRecord class. By default
# attributes will be persisted in column family
# "devise", but you can change by setting
# column_family_name_for_devise to something else.
#
module Devise
@thhermansen
thhermansen / gist:634104
Created October 19, 2010 12:29
Forklaring av Devise encryptor
require "digest/sha1"
module Devise
module Encryptors
# = Sha1
# Uses the Sha1 hash algorithm to encrypt passwords.
class Sha1 < Base
# Gererates a default password digest based on stretches, salt, pepper and the
# incoming password.
def self.digest(password, stretches, salt, pepper)
@thhermansen
thhermansen / carrierwave_tasks.rake
Created August 11, 2010 12:55 — forked from mrrooijen/carrierwave_tasks.rb
CarrierWave Amazon S3 reprosessor rake task
##
# CarrierWave Amazon S3 File Reprocessor Rake Task
#
# Written (specifically) for:
# - CarrierWave
# - Ruby on Rails 3
# - Amazon S3
#
# Works with:
# - Any server of which you have write-permissions in the Rails.root/tmp directory
With Rspec 1.3.0:
it "should pass.. ;-)" do
mock_model(Object, :valid? => true).valid?.should == true
end
--> Passes
it "should pass.. ;-)" do
mock_model(Object, :valid? => true).should be_valid
end
--> Fails, with msg: undefined method `handling_predicate!' for #<Spec::Matchers::Be:0x7f2760f154f8 @args=[:be_valid]>