Skip to content

Instantly share code, notes, and snippets.

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

Erich Soares Machado erichmachado

🏠
Working from home
View GitHub Profile
@erichmachado
erichmachado / rails_template.rb
Last active October 13, 2015 04:17
Ruby on Rails 4.x application template
def commit(message)
git add: '-A'
git commit: "-qm \"#{message}\""
end
# Initializing Git
git :init
commit 'Initial commit'
@erichmachado
erichmachado / mvn.sh
Last active August 29, 2015 14:07
Gnome Notification support for Maven
if [ -x /usr/bin/notify-send ]; then
mvn () {
command mvn "$@"
if [ $? -ne 0 ]; then
notify-send --expire-time=2000 --icon=/usr/share/icons/gnome/scalable/status/error.svg Maven "\"$*\" finished with errors."
else
notify-send --expire-time=2000 --icon=/usr/share/icons/gnome/scalable/status/info.svg Maven "\"$*\" finished successfully!"
fi
}
fi
@erichmachado
erichmachado / mad.bas
Created November 4, 2014 01:08
MAD Magazine computer program in BASIC
10 HOME
20 SIZE=1.2:XC=140:YC=90
30 HGR2:HCOLOR=3:HPLOT 0,0:CALL -3082:HCOLOR=0
40 READ X,Y,X1,Y1
50 IF X=999 THEN 100
60 FX=X*SIZE+XC:FY=176-(Y+YC)
70 LX=X1*SIZE+XC:LY=176-(Y1+YC)
80 HPLOT FX,FY TO LX,LY:HPLOT FX+1,FY TO LX+1,LY
90 GOTO 40
100 POKE 50,63
@erichmachado
erichmachado / mad.java
Created November 4, 2014 01:10
MAD Magazine computer program in Java
import java.awt.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.imageio.*;
import java.io.*;
public class Main {
public static final int WIDTH = 400;
public static final int HEIGHT = 480;
#!/usr/bin/osascript
on run { available_date, termin_url }
display dialog "Found an available slot on " & available_date buttons { "OK", "Not interested" } default button "OK"
if result = { button returned: "OK" } then
open location termin_url
end
end run

Keybase proof

I hereby claim:

  • I am erichmachado on github.
  • I am erichmachado (https://keybase.io/erichmachado) on keybase.
  • I have a public key ASDM1Vop08fCIebnATqFvBjikoyCt4h1_PUCnKv-lIvVVwo

To claim this, I am signing this object:

@erichmachado
erichmachado / set-git-signing-key.sh
Last active November 21, 2019 19:46
Set Git/GitHub PGP signing key
#!/usr/bin/env sh
# To test the script, set the GNUPGHOME to a temporary directory, e.g:
# $ export GNUPGHOME="$(mktemp -d)"
set -eu -o pipefail
DEPENDENCIES="gpg git"
EXPIRATION="${EXPIRATION:-6m}"
ALGORITHM="${ALGORITHM:-RSA}"
class CommentsController < ApplicationController
def users_comments
posts = Post.all
comments = posts.map(&:comments).flatten
@user_comments = comments.select do |comment|
comment.author.username == params[:username]
end
end
end