Skip to content

Instantly share code, notes, and snippets.

package config
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
)
type ConfigHash map[string]string
@etdebruin
etdebruin / gist:702d16c74e254c879fc8
Created April 15, 2015 03:21
Set site_id via application_controller
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_site
# before_filter :set_site
# def set_site
# $site = Site.find_by_url(request.host)
# session[:site_id] = Site.find_by_url(request.host).id
2015/01/23 14:09:40 POST /post HTTP/1.1
Host: kyzjcmnjed.localtunnel.me
Connection: close
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded
User-Agent: Mandrill-Webhook/1.0
X-Forwarded-For: 54.185.102.28
X-Forwarded-Proto: https
X-Mandrill-Signature: R2Jr2hJMdFY2HmKccwguY0ApMYo=
web:
build: .
command: php -S 0.0.0.0:8000 -t /var/www/html/web
ports:
- "8000:8000"
links:
- db
- db:database
volumes:
- .:/code
@etdebruin
etdebruin / gist:1db453f9c201fc0c8031
Created December 10, 2014 20:46
.bash_profile for docker
let i=0
while [ "$(boot2docker status)" != "running" ]; do
if [ $i -lt 10 ]; then
boot2docker start
sleep 3
let i=$i+1
else
break
fi
done
musolist@musolist:/mnt/musolist/current$ bundle exec rails c
Loading production environment (Rails 4.0.5)
irb(main):001:0> Song.reconfigure_search_index
=> #<Hashie::Mash acknowledged=true ok=true>
irb(main):002:0> Song.reindex_all
NoMethodError: undefined method `fields' for nil:NilClass
from /mnt/musolist/shared/bundle/ruby/2.0.0/gems/activerecord-4.0.5/lib/active_record/connection_adapters/mysql2_adapter.rb:227:in `exec_query'
from /mnt/musolist/shared/bundle/ruby/2.0.0/gems/activerecord-4.0.5/lib/active_record/connection_adapters/mysql2_adapter.rb:235:in `select'
from /mnt/musolist/shared/bundle/ruby/2.0.0/gems/activerecord-4.0.5/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
from /mnt/musolist/shared/bundle/ruby/2.0.0/gems/activerecord-4.0.5/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
1) Search::Engines::ClassifiedEngine a new engine object returns a Stretcher::SearchResults object when calling search
Failure/Error: response = @engine.search
Stretcher::RequestError:
Error processing request (503)! get URL: http://localhost:9200/musolist_test_classifieds/_search
Resp Body: #<Hashie::Mash error="SearchPhaseExecutionException[Failed to execute phase [query], all shards failed]" status=503>
# ./app/search/search/engines/classified_engine.rb:192:in `search'
# ./spec/search/engines/classified_engine_spec.rb:51:in `block (3 levels) in <top (required)>'
2) Search::Engines::ClassifiedEngine a new engine object returns an empty array of results when calling search
Failure/Error: response = @engine.search
<%= form_for(@employment, :html => {:id => "user-form", :class => "user-form"}) do |f| %>
<% if @employment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@employment.errors.count, "error") %> prohibited this employment from being saved:</h2>
<ul>
<% @employment.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
@etdebruin
etdebruin / channel.create.json
Created March 15, 2013 20:29
create.channel.json
{
"api_key" : "f57641e8906d5efe20d5",
"name" : "Monk Developers",
"label" : "devs",
"callback_url" : "http://chamber.dev/prompt/incoming",
"communication" : [
{
"method" : "sms",
"create_number" : false,
@etdebruin
etdebruin / sinatra log.txt
Created March 6, 2013 20:58
error output.
TypeError - can't convert nil into Integer:
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:974:in `Integer'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:974:in `handle_exception!'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:966:in `block in dispatch!'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:946:in `block in invoke'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:946:in `catch'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:946:in `invoke'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:966:in `rescue in dispatch!'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:969:in `dispatch!'
/var/www/prompt/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:794:in `block in call!'