This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hook our MongoMapper model into Solr | |
module MongoAdapter | |
class InstanceAdapter < Sunspot::Adapters::InstanceAdapter | |
def id | |
@instance.id | |
end | |
end | |
class DataAccessor < Sunspot::Adapters::DataAccessor | |
def load(id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
include MongoMapper::Document | |
include MongoMapper::Sunspot | |
belongs_to :crawl | |
many :inventories | |
key :product_no, Integer | |
key :price_in_cents, Integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install sunspot_rails | |
class Foo | |
include MongoMapper::Document | |
include Sunspot::Rails::Searchable | |
key :title, String | |
searchable do | |
text :title | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
access_log /opt/nginx/logs/test_server.access.log main buffer=32k; | |
error_log /opt/nginx/logs/test_server.error.log info; | |
expires 6h; | |
listen 2300 default rcvbuf=64k backlog=128; | |
root /opt/apps/test_server/current/public; | |
server_name test_server.com www.test_server.com; | |
passenger_enabled on; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set daemon 60 | |
set logfile syslog facility log_daemon | |
set mailserver localhost | |
set mail-format { from: monit@example.comm } | |
set alert root@localhost | |
set httpd port 2812 and | |
allow admin:test | |
include /etc/monit.d/* | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'rdf' | |
require 'rdf/rdfxml' | |
PROGRAMMES_URL = 'http://www.bbc.co.uk/programmes' | |
PO = RDF::Vocabulary.new("http://purl.org/ontology/po/") | |
brand_pid = 'b0081dq5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BREW_HOME=$HOME/.homebrew | |
$ brew install libxml2 | |
$ brew link libxml2 | |
$ brew install https://github.com/adamv/homebrew-alt/raw/master/duplicates/libxslt.rb | |
$ brew link libxslt | |
$ brew install libiconv | |
$ brew link libiconv | |
$ gem install nokogiri -- --with-xml2-dir=$BREW_HOME/Cellar/libxml2/2.7.8 --with-xslt-dir=$BREW_HOME/Cellar/libxslt/1.1.26 --with-iconv-dir=$BREW_HOME/Cellar/libiconv/1.13.1/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
var hasTouch = /android|iphone|ipad/i.test(navigator.userAgent.toLowerCase()), | |
eventName = hasTouch ? 'touchend' : 'click'; | |
/** | |
* Bind an event handler to the "double tap" JavaScript event. | |
* @param {function} doubleTapHandler | |
* @param {number} [delay=300] | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(){ | |
var instance = null; | |
function MySingleton(){ | |
if(instance !== null){ | |
throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()"); | |
} | |
this.initialize(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
File: KeychainItemWrapper.h | |
Abstract: | |
Objective-C wrapper for accessing a single keychain item. | |
Version: 1.2 - ARCified | |
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple | |
Inc. ("Apple") in consideration of your agreement to the following | |
terms, and your use, installation, modification or redistribution of |
OlderNewer