A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
sentry
SENTRY_SECRET_KEY
to random 32 char stringdocker-compose up -d
docker-compose exec sentry sentry upgrade
to setup database and create admin userdocker-compose exec sentry pip install sentry-slack
if you want slack plugin, it can be done laterdocker-compose restart sentry
9000
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too. | |
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready! | |
Resources: | |
sslSecurityGroupIngress: | |
Type: AWS::EC2::SecurityGroupIngress | |
Properties: | |
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]} | |
IpProtocol: tcp | |
ToPort: 443 |
<html> | |
<head> | |
<script type="text/javascript"> | |
// Your Client ID can be retrieved from your project in the Google | |
// Developer Console, https://console.developers.google.com | |
var CLIENT_ID = '436763072331-rod105o2ppkpjrcdpsmrvmn2st3qg9el.apps.googleusercontent.com'; | |
var SCOPES = ['https://www.googleapis.com/auth/drive.readonly']; |
## http://stackoverflow.com/questions/7145256 | |
module FactoryGirl | |
module Strategy | |
class Find | |
def association(runner) | |
runner.run | |
end | |
def result(evaluation) | |
build_class(evaluation).where(get_overrides(evaluation)).first |
class Api::UploadsController < ApiController | |
def create | |
@upload = Upload.new(upload_params) | |
ensure | |
clean_tempfile | |
end | |
private |
* { margin: 0; } | |
html, body { height: 100%; font-family: Arial, Helvetica, sans-serif; } | |
body { background: #f5f5f5; } | |
img { border-style: none; font-weight: normal; } | |
a:link, a:visited { color: #009; font-weight: bold; text-decoration: none; } | |
a:hover, a:active { color: #6cb33f; font-weight: bold; text-decoration: none; outline: none; } | |
a:focus, a:active { outline: none; } | |
:focus { outline-style: none; } | |
.clear { clear: both; margin: 0px; padding: 0px; height: 1px; } | |
p { color: #333; margin: 0px 0px 5px; font-size: 0.8em; display: block; width: 100%; } |
To test the parser, try to decode with a bad formatted json: (I don't know if it's the best test, but you check if you are using the json parser in the rails 2.3 official patch)
def batch_session_prune(keep_after = 1.month.ago, batch_by = 1.day, pause_time = 10) | |
time = ActiveRecord::SessionStore::Session.order(:updated_at).first[:updated_at] | |
while time < keep_after | |
time = time + batch_by | |
puts "Deleting sessions from #{time.to_s(:short)}" | |
ActiveRecord::SessionStore::Session.where('updated_at < ?', time).delete_all | |
sleep pause_time |