Skip to content

Instantly share code, notes, and snippets.

Thorbjørn Hermansen thhermansen

Block or report user

Report or block thhermansen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2721090
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 Apr 17, 2012
WebOrder data third party
View third_party.xml
<?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>
View order_export_request.xml
<?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 Sep 7, 2011
ORM base class simplified
View base.rb
class Base
end
@thhermansen
thhermansen / sunspot.rb
Created Jun 5, 2011
Sunspot rspec helper file
View sunspot.rb
#
# 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 Jun 5, 2011
Hbase site configuration file
View car.rb
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
Give Devise support for MassiveRecord
View devise_orm_massive_record.rb
#
# 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 Oct 19, 2010
Forklaring av Devise encryptor
View gist:634104
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 Aug 11, 2010 — forked from mrrooijen/carrierwave_tasks.rb
CarrierWave Amazon S3 reprosessor rake task
View carrierwave_tasks.rake
##
# 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
View gist:276027
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]>
You can’t perform that action at this time.