Skip to content

Instantly share code, notes, and snippets.

View haarts's full-sized avatar

Harm Aarts haarts

View GitHub Profile
<item title="Apple iPhone 3G 16GB Black" link="http://ds1.nl/c/?wi=69557&si=860&li=77503&dl=%2Faanbieding_informatie%2FApple-iphone-3G-16GB-zwart%2FFlex100-1jaar-Verlenging%3Futm_source%3D1001%26utm_medium%3D1&ws=" daisycon_unique_id="D27029d204c15cb272fe1721975c2a178" description="Apple iPhone 3G 16GB Black slechts 411 euro bij T-Mobile" img_medium="http://bsimg.nl/images/2/2_Aplleiphone3G16GBzwart_1.jpg" internal_id="885909254040/TMOBCVF10012" minimum_price="411.00" shipping_costs="4.95" subscription_price="100.00" category="GSM + Abonnement" gsm_brand="Apple" gsm_model="Apple iPhone 3G 16GB Black" shipping_duration="2-5 dagen" subscription_duration="12" subscription_name="Verlenging Flex 100 1 jaar" provider="T-Mobile" subscription_renewal="ja" priority="" subscription_allowance_type="" subscription_allowance_sms="" subscription_allowance_minutes="" subscription_installation_costs="" gsm_ean="" sub_category="" specification="" ean="" gsm_type="" delivery_time="" />
<item>
<title><![CDATA[Apple iPhone 3G 16GB Black]]></title>
<link><![CDATA[http://ds1.nl/c/?wi=69557&si=860&li=77503&dl=%2Faanbieding_informatie%2FApple-iphone-3G-16GB-zwart%2FFlex100-1jaar-Verlenging%3Futm_source%3D1001%26utm_medium%3D1&ws=]]></link>
<daisycon_unique_id><![CDATA[D27029d204c15cb272fe1721975c2a178]]></daisycon_unique_id>
<description><![CDATA[Apple iPhone 3G 16GB Black slechts 411 euro bij T-Mobile]]></description>
<img_medium><![CDATA[http://bsimg.nl/images/2/2_Aplleiphone3G16GBzwart_1.jpg]]></img_medium>
<internal_id><![CDATA[885909254040/TMOBCVF10012]]></internal_id>
<minimum_price><![CDATA[411.00]]></minimum_price>
<shipping_costs><![CDATA[4.95]]></shipping_costs>
<subscription_price><![CDATA[100.00]]></subscription_price>
CREATE TABLE `affiliate_new_contracts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plan_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`contract_length` int(11) DEFAULT NULL,
`phone_brand` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`phone_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`phone_price` float DEFAULT NULL,
`price` float DEFAULT NULL,
`average_price_per_month` float DEFAULT NULL,
`phone_price_guestimate` float DEFAULT NULL,
@haarts
haarts / gist:1056741
Created June 30, 2011 17:38
One slow query
# This query takes only a fraction of a second locally and looong on heroku
# Heroku app name: floating-moon-774
# MongoHQ 'eko', app: 'app558262'
Marker.where(:finished => true, :operator_comment => false).desc(:created_at).limit(4)
# via 'heroku console':
>> puts Time.now ; 100.times { Marker.where(:finished => true, :operator_comment => false).desc(:created_at).limit(4).entries} ; puts Time.now
Thu Jun 30 07:22:40 -0700 2011
Thu Jun 30 07:23:29 -0700 2011
@haarts
haarts / gist:1640182
Created January 19, 2012 14:06
Failing Rack::Cors Rspec
# in config/application.rb
config.middleware.use Rack::Cors do
allow do
origins '*'
resource '/search*', :headers => :any, :methods => :get
end
end
# in spec/requests/cors_spec.rb
@haarts
haarts / rbenv-install-system-wide.sh
Created January 30, 2012 10:20
rbenv install and system wide install on Ubuntu 10.04 LTS.
#!/bin/bash
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install vim git-core curl zlib1g-dev libreadline-dev libssl-dev
# Install rbenv
if [ ! -d "/usr/local/rbenv" ]; then
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
curl -XPUT 'localhost:9200/pictures/picture/1' -d '{ "user" : "senthil", "Title" : "trying out Elastic Search"}'
curl -XPUT 'localhost:9200/pictures/interaction/_mapping' -d '{ "interaction" : { "_parent" : { "type" : "picture" } } }'
curl -XPUT 'localhost:9200/pictures/interaction/1?parent=1' -d '{ "tag" : "tree" }'
curl -XPUT 'localhost:9200/pictures/interaction/2?parent=1' -d '{ "tag" : "house" }'
@haarts
haarts / gist:1939980
Created February 29, 2012 10:57
ElasticSearch model evolution
//simple
{
"picture_url" : "http://foobar.com/1234",
"text" : "some text"
"user_name" : "John"
"created_at" : 2012-2-29
}
//embedded
{
@haarts
haarts / gist:1940344
Created February 29, 2012 11:56
Sample has_child query
{
"query" : {
"has_child" : {
"type" : "interaction",
"query" : {
"term" : {
"text" : "tree"
}
}
}
@haarts
haarts / Gemfile
Created March 19, 2012 15:20 — forked from shardnit/dump_bitcask_data.rb
Dump Riak Bitcask data locally
source 'http://rubygems.org'
gem 'bitcask'
gem 'bert'