Open the postgresql.conf config file:
$> mate /usr/local/var/postgres/postgresql.conf
Uncomment the line with 'log_destination' and set it to 'syslog'
log_destination = 'syslog'
Open the syslog config:
Array.prototype.to_sentence = function() { | |
return this.join(", ").replace(/,\s([^,]+)$/, ' and $1') | |
} |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
# config/initializers/app_config.rb | |
# An initializer that contains config stuff | |
# ... | |
class RedisConfig < Settingslogic | |
source "#{Rails.root}/config/redis.yml" | |
namespace Rails.env | |
end |
Open the postgresql.conf config file:
$> mate /usr/local/var/postgres/postgresql.conf
Uncomment the line with 'log_destination' and set it to 'syslog'
log_destination = 'syslog'
Open the syslog config:
# ======================================== | |
# Testing n-gram analysis in ElasticSearch | |
# ======================================== | |
curl -X DELETE localhost:9200/ngram_test | |
curl -X PUT localhost:9200/ngram_test -d ' | |
{ | |
"settings" : { | |
"index" : { | |
"analysis" : { |
require "csv" | |
class HerokuEnvLogger | |
PREFIX = "HerokuRequest" | |
TIME_STEP = 1.minute * 1000 # ms | |
EXPIRE_IN = 6.hours | |
KEYS = %w[HTTP_X_REQUEST_START | |
HTTP_X_HEROKU_QUEUE_WAIT_TIME | |
HTTP_X_HEROKU_QUEUE_DEPTH | |
HTTP_X_HEROKU_DYNOS_IN_USE] |
# Rails.root/config.ru | |
require "./config/environment" | |
run ActionController::Dispatcher.new |
import nltk | |
text = """The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital | |
computer or the gears of a cycle transmission as he does at the top of a mountain | |
or in the petals of a flower. To think otherwise is to demean the Buddha...which is | |
to demean oneself.""" | |
# Used when tokenizing words | |
sentence_re = r'''(?x) # set flag to allow verbose regexps | |
([A-Z])(\.[A-Z])+\.? # abbreviations, e.g. U.S.A. |
#!/usr/bin/env ruby | |
# Libraries::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
require 'rubygems' | |
require 'sinatra/base' | |
require 'slim' | |
require 'sass' | |
require 'coffee-script' | |
# Application::::::::::::::::::::::::::::::::::::::::::::::::::: |