Skip to content

Instantly share code, notes, and snippets.

View rusllonrails's full-sized avatar
💭
👨‍💻 💻 🖱️ 🍻 🏋️‍♂️

rusllonrails rusllonrails

💭
👨‍💻 💻 🖱️ 🍻 🏋️‍♂️
  • Tbilisi, Georgia
View GitHub Profile
@twetzel
twetzel / deploy.rb
Last active February 22, 2018 09:37 — forked from Jesus/deploy.rb
compile assets local with capistrano 3.2.1 and rails 4.1.1 (fully integrated)
# Clear existing task so we can replace it rather than "add" to it.
Rake::Task["deploy:compile_assets"].clear
namespace :deploy do
desc 'Compile assets'
task :compile_assets => [:set_rails_env] do
# invoke 'deploy:assets:precompile'
invoke 'deploy:assets:precompile_local'
invoke 'deploy:assets:backup_manifest'
@pcreux
pcreux / 000_postgresql_fancy_datatypes
Last active March 18, 2022 16:51
Postgresql fancy datatypes with Rails / ActiveRecord. Run it with `rake`!
# Postgresql fancy datatypes!
* array
* hstore (=~ hash)
* json
* jsonb
Philippe Creux - [@pcreux](http://twitter.com/pcreux)
@stevenyap
stevenyap / Capistrano 3.md
Created February 21, 2014 08:52
Capistrano 3 Setup

This guide explains the way to setup a production server using Capistrano.

Setup Capistrano on LOCAL

  • Capistrano is a development gem which assist the developer to run commands on the production server (something like a Heroku toolbelt)
  • Hence, it is installed and configured on developer's computer
# Gemfile

# Use Capistrano for deployment
@gonzalo-bulnes
gonzalo-bulnes / XXXXXXXXXXXXX_add_authentication_token_to_users.rb
Last active March 6, 2019 15:15
(Update: I've packaged this gist into a gem to make its use easier, see: https://github.com/gonzalo-bulnes/simple_token_authentication.) Add token authentication to your Rails API. Follows the José Valim recomendations and is fully compatible with Devise (tokens are created the first time users sign in). See https://gist.github.com/josevalim/fb7…
# db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb
class AddAuthenticationTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :authentication_token, :string
add_index :users, :authentication_token, :unique => true
end
end
@kazpsp
kazpsp / passwords_controller.rb
Created August 14, 2012 16:40 — forked from guilleiguaran/passwords_controller.rb
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@rusllonrails
rusllonrails / _pay_form.erb.html
Created July 1, 2012 13:00 — forked from vol4ok/_pay_form.erb.html
rails + robokassa example
<form action="<%= @pay_desc['mrh_url'] %>" method="post">
<input type=hidden name=MrchLogin value="<%= @pay_desc['mrh_login'] %>">
<input type=hidden name=OutSum value="<%= @pay_desc['out_summ'] %>">
<input type=hidden name=InvId value="<%= @pay_desc['inv_id'] %>">
<input type=hidden name=Desc value="<%= @pay_desc['inv_desc'] %>">
<input type=hidden name=SignatureValue value="<%= @pay_desc['crc'] %>">
<input type=hidden name=Shp_item value="<%= @pay_desc['shp_item'] %>">
<input type=hidden name=IncCurrLabel value="<%= @pay_desc['in_curr'] %>">
<input type=hidden name=Culture value="<%= @pay_desc['culture'] %>">
<input type=submit value='Оплатить'>
@potomak
potomak / _flash.html.erb
Created January 12, 2012 14:35
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>