- Edit -> Preferences -> Keys
- Press +
- Press
Ctrl+h
as Keyboard Shortcut - Choose "Send Escape Sequence as Action"
- Type
[104;5u
for Esc+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
after_commit :notify_editors, on: :create | |
after_commit :generate_feed_item, on: :create | |
private | |
def notify_editors | |
EditorMailer.send_notification(self).deliver_later | |
end | |
def generate_feed_item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get CSR MD5 | |
openssl req -noout -modulus -in my_csr.csr | openssl md5 | |
# Get cert MD5 | |
openssl x509 -noout -modulus -in my_cert.crt | openssl md5 | |
# Get Key MD5 | |
openssl rsa -noout -modulus -in my_key.key | openssl md5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case testvalue do | |
n when n in [200, 400] -> | |
true | |
_ -> | |
false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in test/test_helper.exs | |
ExUnit.configure(timeout: :infinity) | |
ExUnit.start | |
# ... | |
# when using ecto change/add ownership timeout in config.exs | |
config :myapp, MyApp.Repo, | |
adapter: Ecto.Adapters.Postgres, # not important | |
username: "mydatabaseuser", # not important | |
database: "myapp_test", # not important |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Tester do | |
defstruct [:first, :second] | |
def foo_to_bar(struct = %{__struct__: struct_module}) do | |
updated_list = | |
struct | |
|> Map.from_struct | |
|> Enum.map(&transform_value/1) | |
struct(struct_module, updated_list) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# binding to localhost | |
rails s -b 127.0.0.1 -p 3000 | |
# bind to lvh.me | |
rails s -b lvh.me -p 3000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
pgClass.relname AS tableName, | |
pgClass.reltuples AS rowCount | |
FROM | |
pg_class pgClass | |
LEFT JOIN | |
pg_namespace pgNamespace ON (pgNamespace.oid = pgClass.relnamespace) | |
WHERE | |
pgNamespace.nspname NOT IN ('pg_catalog', 'information_schema') AND | |
pgClass.relkind='r'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users_by_locale.each do |locale, locale_users| | |
I18n.with_locale(locale) do | |
mail( | |
bcc: locale_users.map(&:email), | |
subject: I18n.t('user_mailer.new_follower.subject') | |
) | |
end | |
end | |
private |
In your compose file, map volum to a local folder that contains the database dump file
db:
image: postgres:9.4.1
volumes:
- tmp:/tmp/dumps
Run the application using docker-compose up
NewerOlder