Skip to content

Instantly share code, notes, and snippets.

@anderson-mota
anderson-mota / how-to-git-patch-diff.md
Created September 29, 2020 21:40 — forked from nepsilon/how-to-git-patch-diff.md
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff > some-changes.patch
@anderson-mota
anderson-mota / rails http status codes
Created July 2, 2020 16:36 — forked from mlanett/rails http status codes
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
@anderson-mota
anderson-mota / docker-install-lubuntu-17.04.sh
Created September 24, 2019 22:43 — forked from pjmazenot/docker-install-lubuntu-17.04.sh
Install Docker CE on Lubuntu 17.04
#!/bin/sh
# Install Docker CE on Lubuntu 17.04
# Run this script with sudo privileges `sudo docker-install-lubuntu-17.04.sh`
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
apt-get update
apt-get install -y docker-ce
@anderson-mota
anderson-mota / Dockerfile
Created July 4, 2018 01:05 — forked from varyonic/Dockerfile
Dockerfile with chromedriver
# See https://codeship.com/documentation/docker/browser-testing/
FROM myapp:base
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip
# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
@anderson-mota
anderson-mota / Install_Phpstorm.sh
Created April 23, 2016 04:40 — forked from theodorosploumis/Install_Phpstorm.sh
Update phpstorm on Ubuntu linux.
#!/bin/bash -e
# IMPORTANT. My phpstom installation exists on /opt/phpstorm.
# IMPORTANT. Run with sudo!
# Early Access program: https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program
echo -n "Please enter the PhpStorm download url (eg http://download.jetbrains.com/webide/PhpStorm-EAP-141.690.tar.gz): "
read url
# Download file from url
echo "Downloading PhpStorm to ~/Desktop"
@anderson-mota
anderson-mota / AuthInterceptor.js
Created March 15, 2016 22:58 — forked from danjesus/AuthInterceptor.js
A simple angular interceptor
(function () {
'use strict';
angular.module('smartticket.services')
.factory('BearerAuthInterceptor', function ($window, $q, $localStorage, $location) {
return {
request: function (config) {
config.headers = config.headers || {};
@anderson-mota
anderson-mota / 0_reuse_code.js
Created October 21, 2015 17:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
/**
* Referências caso necessário
* http://copacocacola.terra.com.br/infografico/dribles/info-dribles/js/info.js
*/
var facebook = (function() {
var share =function(data, type) {
type = type ? type : 'feed';
FB.ui({
/*
* This Class serializeTo
* Return dataserialize object, array or string
* @author Gustavo da Silva Rodrigues <[email protected]>
*/
;(function ( $, window, document, undefined ) {
var pluginName = "serializeTo",
/**
* default Configuration