Skip to content

Instantly share code, notes, and snippets.

View derekbarber's full-sized avatar

Derek Barber derekbarber

View GitHub Profile
# username = "my_username"
# pwd = "my_password"
# target_path = "my_target_path"
# saving auth cookie
system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \
https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027}
(25..600).each do |i|
=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')

To drop the database:

heroku pg:reset DATABASE

To recreate the database:

heroku run rake db:migrate

To populate the database with seed data:

How to reset postgres' primary key sequence when it falls out of sync?
heroku pg:psql
-- Login to psql and run the following
-- What is the result?
SELECT MAX(id) FROM your_table;
-- Then run...
-- This should be higher than the last result.

Keybase proof

I hereby claim:

  • I am derekbarber on github.
  • I am derekbarber (https://keybase.io/derekbarber) on keybase.
  • I have a public key whose fingerprint is 95B4 AFE8 EE0C D4B6 9017 843E 3C47 FA00 438A D295

To claim this, I am signing this object:

=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')
@derekbarber
derekbarber / nginx-config-rails4-with-puma-ssl-version.conf
Last active September 2, 2015 18:06 — forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Nginx config for rails 4 application using puma [ssl and non-ssl version]
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
/*!
* froala_editor v2.7.1 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2017 Froala Labs
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
<div class="dropdown-menu dropdown-menu-fit dropdown-menu-right dropdown-menu-anim dropdown-menu-top-unround dropdown-menu-sm show" style="width: 240px; position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(970px, 71px, 0px);" x-placement="bottom-end">
<div class="kt-user-card kt-margin-b-40 kt-margin-b-30-tablet-and-mobil" style="background-image: url(/packs/media/images/keen/misc/head_bg_sm-66cadb6d43cfd231fc863b7e775886a1.jpg)">
<div class="kt-user-card__wrapper">
<div class="kt-user-card__pic">
<img class="kt-rounded" src="http://gravatar.com/avatar/2f1af9ac1462a8524608d19e83f3d25e?size=40">
</div>
<div class="kt-user-card__details">
<div class="kt-user-card__name">Derek Barber</div>
<div class="kt-user-card__position">Family Member</div>
</div>
  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.
  2. bundle
  3. Run RAILS_ENV=production rake db:create db:migrate db:seed
  4. Run rake secret and copy the output
  5. From the command line: export SECRET_KEY_BASE=output-of-rake-secret
  6. To precompile your assets, run rake assets:precompile. This will create a folder public/assets that contains all of your assets.
  7. Run RAILS_ENV=production rails s and you should see your app.

Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.