Skip to content

Instantly share code, notes, and snippets.

View wellington1993's full-sized avatar
🏠
Working from home

Wellington Torrejais da Silva wellington1993

🏠
Working from home
View GitHub Profile
@wellington1993
wellington1993 / nginx_proxy.config
Created August 22, 2018 19:46 — forked from ankitsinghaniyaz/nginx_proxy.config
Elastic Beankstalk Nginx configuration to supports /assets and /packs
# This is to enable WS support. Credits: # https://gist.github.com/Bubelbub/0a942a0d51a3d329897d
# THIS WORKS! for running the example 5.0.0.beta1 chat app on a single instance Elastic beanstalk AWS instance
files:
"/etc/nginx/conf.d/websockets.conf" :
content: |
upstream backend {
server unix:///var/run/puma/my_app.sock;
}
@wellington1993
wellington1993 / gist:5c7c6faa14564dcf79801972156260c6
Created August 22, 2018 19:13 — forked from mattd/gist:1006398
nginx try_files with a proxy_pass
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
@wellington1993
wellington1993 / svn-pristine-find.sh
Created August 16, 2018 18:14 — forked from mcbrwr/svn-pristine-find.sh
fix for "svn pristine text not present" error in a working copy
#!/bin/bash
# for an "svn pristine text not present" error like this:
# svn: E155010: Pristine text 'd6612ee6af5d9fb4459cbe7e2e8e18f7fb4201f8' not present
# you can delete the file and retrieve it with svn up
# (if you have local modifications, make up your own plan)
# -
# Run this script from the root of the working copy.
# It retrieves the file that's causing the error from wc.db
# usage example : ./svn-pristine-find.sh d6612ee6af5d9fb4459cbe7e2e8e18f7fb4201f8
@wellington1993
wellington1993 / rails.logrotate
Created August 15, 2018 11:50 — forked from gigorok/rails.logrotate
Logrotate for Rails
#
# File: /etc/logrotate.d/rails
# Test: logrotate -f /etc/logrotate.d/rails
#
/var/www/*/log/*.log {
daily
dateext
notifempty
missingok
rotate 30
@wellington1993
wellington1993 / api.markdown
Created July 25, 2018 22:48 — forked from jcasimir/api.markdown
Exposing an API in Rails 3

Exposing an API

APIs are becoming an essential feature of modern web applications. Rails does a good job of helping your application provide an API using the same MVC structure you're accustomed to.

In the Controller

Let's work with the following example controller:

class ArticlesController < ApplicationController
class ChangeStoreSettingsToLongtext < ActiveRecord::Migration
def up
change_column :site_configs, :store_settings, :longtext
end
def down
change_column :site_configs, :store_settings, :text
end
end
@wellington1993
wellington1993 / nginx.conf
Created May 21, 2018 18:49 — forked from baskaran-md/nginx.conf
NginX allow POST on static pages.
# ...
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
# Copy and paste this to the rails console to test your email settings
class MyMailer < ActionMailer::Base
def test_email
@recipients = "[email protected]"
@from = "[email protected]"
@subject = "test from the Rails Console"
@body = "This is a test email"
end
end
@wellington1993
wellington1993 / curl.md
Created March 20, 2018 12:36 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

How to install Opera browser in Ubuntu from PPA

To install the Opera browser from PP under Ubuntu you need to follow these steps :

Before starting open up your terminal.

First you need to setup the key with

wget -O - http://deb.opera.com/archive.key | sudo apt-key add -