Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am evedreamer on github.
  • I am chintaikai (https://keybase.io/chintaikai) on keybase.
  • I have a public key ASB-7ZSs3rfvdavc80cfkhuQAKqAfLgGLdeo96JLONRjZwo

To claim this, I am signing this object:

@EveDreamer
EveDreamer / db.rake
Created February 28, 2019 03:53 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@EveDreamer
EveDreamer / self-signed-localhost-for-rails.txt
Created October 11, 2016 06:17 — forked from webdevotion/self-signed-localhost-for-rails.txt
SSL self signed localhost for rails start to finish, no red warnings.
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@EveDreamer
EveDreamer / model_json.rb
Created June 12, 2016 10:01 — forked from danielevans/model_json.rb
Converting Serialized YAML to Serialized JSON in Rails models
class Medium < ActiveRecord::Base
serialize :payload, JSON
end
@EveDreamer
EveDreamer / _message.html.erb
Created May 19, 2016 10:23 — forked from Joseph-N/_message.html.erb
Tutorial code snippets for chat application in rails. Tutorial link http://goo.gl/l3e8zN
<li class="<%= self_or_other(message) %>">
<div class="avatar">
<img src="http://placehold.it/50x50" />
</div>
<div class="chatboxmessagecontent">
<p><%= message.body %></p>
<time datetime="<%= message.created_at %>" title="<%= message.created_at.strftime("%d %b %Y at %I:%M%p") %>">
<%= message_interlocutor(message).name %><%= message.created_at.strftime("%H:%M %p") %>
</time>
</div>
@EveDreamer
EveDreamer / capybara cheat sheet
Created March 8, 2016 06:27 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
# config/locales/en.yml
en:
exception:
show:
not_found:
title: "Not Found"
description: "The page you were looking for does not exists."
internal_server_error:
title: "Internal Server Error"