Skip to content

Instantly share code, notes, and snippets.

View puneetpandey's full-sized avatar
🏠
Working Remotely

Puneet Pandey puneetpandey

🏠
Working Remotely
View GitHub Profile
class ActsController < ActionController::Base
before_filter :get_user
def new
@act = @user.acts.new
end
def create
@act = @user.acts.new params[:act]
class MyLittleProgram
def execute
h = { h1: 'value1', h2: 'value2', h3: 'value3', h4: 'value4' }
a = [ '1', '2', '3', '4' ]
h.each_with_index do |(k, v), i|
break if a.size > h.keys.size
a.each_with_index { |val, index|
if i == index
# Controller /app/controllers/posts_controller.rb
def index
@posts = Post.all
end
# Spec /spec/controllers/posts_controller_spec.rb
describe "GET #index" do
it "responds successfully with a HTTP 200 status code" do
get :index
expect(response).to be_success
@puneetpandey
puneetpandey / nginx_proxy.config
Last active August 4, 2021 06:37
Solution for the Background requests that takes more than 60s to complete
client_max_body_size 30M;
proxy_send_timeout 600;
proxy_read_timeout 1h;
send_timeout 600;
upstream backend {
server unix:///var/run/puma/my_app.sock ;
}
server {