Skip to content

Instantly share code, notes, and snippets.

View pfeiffer's full-sized avatar

Mattias Pfeiffer pfeiffer

View GitHub Profile
window.onload = function() {
alert(':-)');
}
class SearchSession < ActiveRecord::Base
include Redis::Objects
belongs_to :user
validates :user_id, :presence => true
serialize :conditions, Hash
list :cached_results_ids
alert('word up!');
[2011-07-28 00:18:32,655][WARN ][http.netty ] [Hermod] Caught exception while handling client http traffic, closing connection
java.lang.IllegalArgumentException: empty text
at org.elasticsearch.common.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.java:103)
at org.elasticsearch.common.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:68)
at org.elasticsearch.common.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:81)
at org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:198)
at org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:107)
at org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:470)
at org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:541)
at org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.channelDisconnected(R
{
"custom_score": {
"query": {
"filtered": {
"query": {
"match_all": { }
},
"filter": {
"and": [
{
@pfeiffer
pfeiffer / gist:1122596
Created August 3, 2011 13:09
Example query
{
"custom_score": {
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [
{
@pfeiffer
pfeiffer / gist:1122810
Created August 3, 2011 14:50
ES test query
We couldn’t find that file to show.
class WorkoutLink < ActiveRecord::Base
belongs_to :workout
YOUTUBE_REGEXP = /youtu(?:\.be\/|be\.com\/watch\?v=)(\w{11})/
VIMEO_REGEXP = /vimeo\.com\/([\d+]+)/
def youtube_video_id
$1 if url =~ YOUTUBE_REGEXP
end
SearchSession.prototype = {
initialize: function(options) {
this.options = options;
this.render();
},
render: function() {
// Run through the criterias:
$.each(this.options.data, function(key, data) {
this.addCriteria(key, data).render();
@pfeiffer
pfeiffer / rbenv-install-system-wide.sh
Created July 20, 2012 11:50 — forked from v1nc3ntlaw/rbenv-install-system-wide.sh
rbenv install ruby 1.9.3-p194 on Debian 6 Squeeze
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev