Skip to content

Instantly share code, notes, and snippets.

View araslanov-e's full-sized avatar

Araslanov Evgeny araslanov-e

  • Russia. Tyumen
View GitHub Profile
@davoclavo
davoclavo / up-and-running-with-edeliver-on-do.md
Last active June 6, 2022 11:55 — forked from mattweldon/up-and-running-with-edeliver-on-do.md
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new ubuntu droplet

Setup Server

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@ChuckJHardy
ChuckJHardy / example_activejob.rb
Last active March 3, 2024 20:10
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@conorh
conorh / nginx.conf
Created April 22, 2015 15:05
Using Nginx as a caching proxy for Refile with Ruby on Rails
http {
...
proxy_cache_path /data/perch.squaremill.com/shared/image_cache levels=1:2 keys_zone=images:10m;
...
}
@srikanthjeeva
srikanthjeeva / https GET request with Basic Auth in Ruby
Created January 28, 2015 20:33
https GET request with Basic Auth in Ruby
require 'net/http'
require 'net/https'
require 'uri'
uri = URI('https://example.com/rest/api/2/1')
Net::HTTP.start(uri.host, uri.port,
:use_ssl => uri.scheme == 'https',
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
@scarfacedeb
scarfacedeb / 1.form.html.haml
Last active January 18, 2023 22:35
Form with multiple button in rails
/ Form excerpt
= f.button t(".save"), class: "btn"
= f.button t(".publish"), class: "btn", name: "publish"
= f.button t(".test"), class: "btn", name: "test"
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@jandudulski
jandudulski / auth.rb
Last active September 14, 2022 12:09
CSRF on Grape
# based on http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html
module Auth
extend ActiveSupport::Concern
included do
helpers do
def session
env['rack.session']
end
@mlanett
mlanett / rails http status codes
Last active April 13, 2024 13:40
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@somebox
somebox / presenters.md
Last active March 26, 2022 02:12
Thoughts About Rails Presenters

Thoughts about Rails Presenters

This is a collection of links, examples and rants about Presenters/Decorators in Rails.


The "Decorator" pattern slowly started gaining popularity in Rails several years ago. It is not part of core Rails, and there's many different interpretations about how it should work in practice.

Jay Fields wrote about it in 2007 (before he switched back to Java and then Clojure): http://blog.jayfields.com/2007/03/rails-presenter-pattern.html