Skip to content

Instantly share code, notes, and snippets.

View diego-aslz's full-sized avatar
🏠
Working from home

Diego Selzlein diego-aslz

🏠
Working from home
View GitHub Profile
package factj.test;
import factj.FactJ;
public class Application {
public static void main(String[] args) {
PersonFabricator.load();
System.out.println(FactJ.build(Person.class));
System.out.println(FactJ.build(Person.class));
}
@diego-aslz
diego-aslz / .bashrc
Last active December 19, 2015 04:59
Some good aliases for SVN.
alias svnu='svn up'
alias sst='svn stat'
alias slog='svn log -l 10'
alias scm='svn commit -m'
alias sme='svn merge'
alias sdf='svn diff | vim -'
svs() {
svn stat | grep -v "classpath" | grep -v "/bin" | grep -v ".settings" | grep -v ".project" | grep -v "target"
}
@diego-aslz
diego-aslz / map.rb
Created September 9, 2013 17:55
How does the `&:name` parameter work?
cities = City.all
cities.map(&:name) # ['City 1', 'City 2']
autoload colors && colors
# cheers, @ehrenmurdick
# http://github.com/ehrenmurdick/config/blob/master/zsh/prompt.zsh
git_branch() {
echo $(/usr/bin/git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})
}
git_dirty() {
st=$(git status -sb 2>/dev/null | wc -l)
@diego-aslz
diego-aslz / modal_dialog_helper.rb
Created October 23, 2013 12:09
Bootstrap Helpers for Rails.
module ModalDialogHelper
def modal_dialog(options={},&block)
content_tag :div, {class: 'modal hide fade', tabindex: -1, role: 'dialog'}.merge(options), &block
end
def modal_header(options={},&block)
content_tag :div, {class: 'modal-header'}.merge(options), &block
end
def modal_body(options={},&block)
package br.com.clouded.web.service.support;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
# -*- encoding : utf-8 -*-
puts "Cities..."
City.transaction do
ro = Province.find_by_uf('RO')
City.create(province_id: ro.id, id: '1100015', lat: -11.9284, lng: -61.9951, name: 'Alta Floresta D\'Oeste')
City.create(province_id: ro.id, id: '1100023', lat: -9.91375, lng: -63.044, name: 'Ariquemes')
City.create(province_id: ro.id, id: '1100031', lat: -13.4864, lng: -60.5411, name: 'Cabixi')
City.create(province_id: ro.id, id: '1100049', lat: -11.4315, lng: -61.4477, name: 'Cacoal')
@diego-aslz
diego-aslz / Desnecessarios.pas
Last active December 29, 2015 04:59
Impressao via Bematech MP4000 TH.
// Essa função você nao precisa, use-a só para ver como a classe é instanciada, pode instanciar direto a impressora USB.
// Esse objeto Configuracoes lê de um arquivo INI, vc pode, em vez de usar algo assim, passar a porta fixa. No caso da USB, a impressora vai procurar sozinha todas as portas COM caso a que você passou não funcione.
function ObterImpressora: TImpressora;
begin
if Configuracoes.TipoImpressora = tiSerial then
begin
Impressora.Porta := Configuracoes.Porta;
Result := Impressora;
end
else
@diego-aslz
diego-aslz / DomainClass.java
Created December 12, 2013 12:00
Proc in Java
package main;
public class DomainClass {
public void doSomething(Object arg0, Proc block) {
// do something
block.run(arg0);
}
}
@diego-aslz
diego-aslz / dotfiles_install.sh
Last active August 29, 2015 14:05
Unila dotfiles installation
#!/bin/bash
if [[ `whoami` == "root" ]]; then
echo "Você está logado como root. Por favor, execute este comando com seu próprio usuário."
exit 1
fi
sudo apt-get install git -y
git clone [email protected]:dsis/dotfiles.git ~/.dotfiles && cd ~/.dotfiles && script/bootstrap