Skip to content

Instantly share code, notes, and snippets.

Working Remotely

Puneet Pandey puneetpandey

Working Remotely
View GitHub Profile
puneetpandey / nginx_proxy.config
Last active Aug 4, 2021
Solution for the Background requests that takes more than 60s to complete
View nginx_proxy.config
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 {
View block.rb
# Code to be executed here
# This part will be 'protected'
raise # Use this to raise any message
# Exception Handling, like argument error, 404
retry # use this if you want the begin block to be executed again, if execption occurs.
# This part will always get executed.
View geminstall.txt
gem install mysql2 --platform=ruby -- '--with-mysql-include=C:\mysql-connector-c-noinstall-6.0.2\include --with-mysql-lib=C:\mysql-connector-c-noinstall-6.0.2\lib --with-mysql-dir=C:\mysql-connector-c-noinstall-6.0.2'
View success.txt
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-include=C:\mysql-connector-c-noinstall-6.0.2\include --with-mysql-lib=C:\mysql-connector-c-noinstall-6.0.2\lib --
This could take a while...
Successfully installed mysql2-0.3.13
Parsing documentation for mysql2-0.3.13
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/mysql2/, skipping
Installing ri documentation for mysql2-0.3.13
1 gem installed
View file1.php
<?php$con = mysql_connect("localhost", "USERNAME", "PASSWORD");
if (!$con) {
die('Could Not Connect: ' . mysql_error());
mysql_select_db("DB_NAME", $con);
$result = mysql_query("SELECT firstname, lastname, email, phone, mobile, address_1, address_2, city, zipcode, country, state FROM TABLE_NAME");
echo "
<table border='1'>
View gist:6995045
if (!isset($_SESSION['username'])) {
header("Location: login.php");
View controller_spec.rb
# Controller /app/controllers/posts_controller.rb
def index
@posts = Post.all
# 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
View h_to_a_mapping.rb
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
View acts.rb
class ActsController < ActionController::Base
before_filter :get_user
def new
@act =
def create
@act = params[:act]
View user_spec.rb
require 'spec_helper'
class User
def initialize(args = {}); end
def email
def mobile