- Template name:
telegram.message
- Content:
{{- /* Telegram message to use: {{ template "telegram.message2" . }} */ -}} {{ define "__alerts_list" -}} {{ range . }} {{if ne (index .Labels "alertname") "" -}} {{ if eq .Status "firing" }}🔴{{ else }}🟢{{ end }} {{- if ne (index .Labels "severity") "" -}} <u><b>P{{ index .Labels "severity" }}</b></u> {{ end -}}
# This file is used by Rack-based servers to start the application. | |
require ::File.expand_path('../config/environment', __FILE__) | |
#prevents DNS rebinding attacks | |
class DNSBinding | |
VALID_HOSTS = %w{localhost:9292 myshop.dev:3000 myshopprod.com} | |
def initialize(app) | |
@app = app | |
end |
📆 Jun 23-24, 2016
🌏 Web site: http://reddotrubyconf.com/ Twitter: http://twitter.com/reddotrubyconf
💁 Ping me @cheeaun on Twitter or leave a comment below if you found some awesome stuff for #rdrc2016. This gist will be updated whenever there's new stuff.
🕙 Previously, on RedDotRubyConf...
Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist https://gist.github.com/kevinelliott/0726211d17020a6abc1f). Note that I expect this to change significantly as I install El Capitan several times.
I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.
This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.
You are encouraged to fork this and modify it to your heart's content to match your own needs.
As your business logic gets complex you may need to implement transactions. The classic example is a bank funds transfer from account A to account B. If the withdrawal from account A fails then the deposit to account B should either never take place or be rolled back.
All the complexity is handled by ActiveRecord::Transactions
. Any model class or instance has a method named .transaction
. When called and passed a block, that block will be executed inside a database transaction. If there's an exception raised, the transaction will automatically be rolled back.
Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).
Other application notes:
- Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
- We use capistrano for deployment.
Salient points for each file:
" Tools for searching and replacing text in Vim | |
" Search for the current visual selection | |
fun! StarSearch(direction) | |
let old_reg = getreg('"') | |
let old_regtype = getregtype('"') | |
exe 'normal! gvy\<esc>gV' | |
let @/ = EscapeMagic(@") | |
call histadd("/", @/) | |
call setreg('"', old_reg, old_regtype) |