Skip to content

Instantly share code, notes, and snippets.

@doabit
doabit / ElasticSearch.sh
Created October 29, 2016 08:20 — forked from ricardo-rossi/ElasticSearch.sh
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
# On Mavericks (same for 10.6+) the biggest issue is that port 5432 is already taken so
# this: --- config.vm.network "forwarded_port", guest: 5432, host: 5433' ---
# should go on 'Vagrantfile' and then you use port 5433 to connect through pgadmin3
echo >&2 "===CUSTOM-MSG=== Setup THE DATABASE"
# installs postgresql database and creates "vagrant" superuser with password "somepass".
sudo apt-get -y install postgresql postgresql-client libpq-dev
echo >&2 "===CUSTOM-MSG=== Create role and login"
@doabit
doabit / gist:7728757
Created December 1, 2013 05:14
rails postgresql sequence reset
ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.reset_pk_sequence!(t) }
@doabit
doabit / gist:7515078
Created November 17, 2013 16:21
minitap with spring and pry
spring rake test test/models/post_test.rb
---
type: suite
start: '2013-11-18 00:19:28'
count: 1
seed: 6999
rev: 4
From: /Users/doabit/Sites/test/rails/tmp/minit/blog/test/models/post_test.rb @ line 7 PostTest#test_the_truth:
@doabit
doabit / gist:7170266
Created October 26, 2013 14:51
update postgresql sequence
select setval('feedbacks_id_seq', (select max(id) from feedbacks));
@doabit
doabit / rails 4 rails 4.0.0.rc1 mountable engine rake db:migrate
Created June 2, 2013 07:01
rails 4.0.0.rc1 mountable engine rake db:migrate task
namespace :db do
task :load_config do
ActiveRecord::Base.configurations = ActiveRecord::Tasks::DatabaseTasks.database_configuration || {}
ActiveRecord::Migrator.migrations_paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths
if defined?(ENGINE_PATH) && engine = Rails::Engine.find(ENGINE_PATH)
if engine.paths['db/migrate'].existent
ActiveRecord::Migrator.migrations_paths += engine.paths['db/migrate'].to_a
end
end
end
module Devise
module Orm
module MongoMapper
module Hook
def devise_modules_hook!
extend Schema
include Compatibility
yield
return unless Devise.apply_schema
devise_modules.each { |m| send(m) if respond_to?(m, true) }
@doabit
doabit / devise.zh-cn.yml
Created July 20, 2010 04:29
devise.zh-cn
zh-cn:
errors:
messages:
not_found: "没有找到"
already_confirmed: "已经确认"
not_locked: "没有锁定"
devise:
failure:
unauthenticated: '继续操作前请注册或者登录.'
unconfirmed: '请先激活您的帐号'