Skip to content

Instantly share code, notes, and snippets.

View murilomothsin's full-sized avatar

Murilo Mothsin murilomothsin

  • Taquara - RS
View GitHub Profile
import 'regenerator-runtime/runtime';
import { getToken, getCompany } from '../reducers/auth';
export class ApiError extends Error {
constructor(status, body) {
super(`ApiError: ${status}. ${JSON.stringify(body)}`);
this.status = status;
this.body = body;
}
@murilomothsin
murilomothsin / puma.service
Created May 22, 2018 11:50
Systemd scripts (/etc/systemd/system)
[Unit]
# https://github.com/puma/puma/blob/master/docs/systemd.md
Description=Puma HTTP Server
After=network.target
[Service]
Type=simple
User=user
@murilomothsin
murilomothsin / post-receive
Created March 23, 2018 13:58
example of a hook to automagically deploy a Rails app
#!/bin/bash
source $HOME/.bash_profile
APP_NAME="scopi"
APP_PATH=/home/scopi/apps/${APP_NAME}
# Production environment
export RAILS_ENV="production"
exit_with_error() {
@murilomothsin
murilomothsin / useful_git.md
Created January 29, 2018 11:01
Some useful Git commands I use in a regular basis

Basic Commands

Updating your project with new information from Github

This command will update the references/branches locally on your machine and notify about deleted branches from origin

git fetch -p

Creating a new working branch

Before creating a branch, update your project, after that, go to master branch and then run the command:

@murilomothsin
murilomothsin / puma.rb
Created November 30, 2017 22:58 — forked from aconfee/puma.rb
/myapp/config/puma.rb
# Change to match your CPU core count
workers 1
# Min and Max threads per worker
threads 1, 6
directory "/home/rails/RubyFinanceTracker"
app_dir = File.expand_path("../..", __FILE__)
shared_dir = "#{app_dir}/shared"
@murilomothsin
murilomothsin / script.sh
Created November 24, 2017 13:27
Create a rails project specifying the version
mkdir myapp
cd myapp
echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'rails', '4.2.9'" >> Gemfile
bundle install
bundle exec rails new . --force --skip-bundle
bundle update
/*
* Original script by: Shafiul Azam
* Version 4.0
* Modified by: Luigi Balzano
* Description:
* Inserts Countries and/or States as Dropdown List
* How to Use:
In Head section:
@murilomothsin
murilomothsin / pub-sub.js
Created July 12, 2017 19:40 — forked from reu/pub-sub.js
node.js redis pub-sub example
var redis = require("redis")
, subscriber = redis.createClient()
, publisher = redis.createClient();
subscriber.on("message", function(channel, message) {
console.log("Message '" + message + "' on channel '" + channel + "' arrived!")
});
subscriber.subscribe("test");
@murilomothsin
murilomothsin / config.json
Created May 30, 2016 14:49 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Primeira aplicação Angular</title>
<script type="text/javascript" src="angular.js"></script>
</head>
<body ng-app>
<div>
<input type="text" ng-model="nome"></input>