Skip to content

Instantly share code, notes, and snippets.

View willmadruga's full-sized avatar
💭
(while true (learn))

William Madruga willmadruga

💭
(while true (learn))
View GitHub Profile
##########################################################################
# Setting up Java 8 without actually installing.
# This is a one time setup and it is safe to delete containers and images after setting up.
# 1
# download java:8 docker image
# docker pull java:8
# 2
# create container
@willmadruga
willmadruga / ComponentBuilder.java
Created March 23, 2014 07:17
dashboard updater UI
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
/**
* Created by wmadruga on 22/03/14.
*/
public class ComponentBuilder {
protected JFrame jFrameSetup(String name, String title, int width, int height, int scale) {
@willmadruga
willmadruga / drools_loader.py
Created November 24, 2013 09:42
Loading DRL file in guvnor via its rest api. work in progress
'''
Created on Nov 24, 2013
@author: wmadruga
'''
import http.client
import base64
def main():
@willmadruga
willmadruga / 0README
Last active December 16, 2015 09:49
Helps deploying and undeploying jars from JBOSS AS 7.
# for this project
create a directory for this project, i.e. jboss-as7-tools.
create a lib directory inside it.
put functions.sh inside lib directory and keep main.sh inside jboss-as7-tools.
run main.sh
# in the future, move lib directory to home and rewrite all my shellscripts to reuse each other when necessary.
@willmadruga
willmadruga / GenericSetter.java
Last active December 15, 2015 07:38
TODO: improve error management.
/**
* Generic Setter - sets a field value based on fields name.
* @param fieldName Should be exactly the same as defined in class.
* @param value value to be set in field.
* @param target object which will receive new value in attribute
*/
private void genericSetter(String fieldName, Object value, Object target) {
try {
Class cls = target.getClass();
Field fld = cls.getDeclaredField(fieldName);
@willmadruga
willmadruga / combat footwork
Created December 29, 2010 17:19
combat footwork
The key to success in footwork is to keep it simple. If you aim toward simplification,
rather than complex or intricate foot patterns, which more resemble dance patterns
than efficiency, your footwork will be smooth, direct and efficient. If you use
economy of motion, you will always be relaxed, which is crucial to your reaction
time and to the speed of your attacks, defenses and counter-attacks.
@willmadruga
willmadruga / create_jpa_class_from_sql.rb
Created November 8, 2010 18:35
Creates java attributes with getter and setter and JPA @annotations from a SQL Create Query Script.
# Creates java attributes with getter and setter and JPA @Annotations from a SQL Create Query Script.
# author: William Madruga
# >> under development.
class String
def camelize
self.split(/[^a-z0-9]/i).map{|w| w.capitalize}.join
end
def uncapitalize
@willmadruga
willmadruga / gist:141625
Created July 6, 2009 19:21
Gerador de classe apartir de Formulário Lotus Notes
' gerador de classe.lss
' Código Lotus Script - categorizado como VB.net só pra usar o Syntax Highlight
' Exibe a lista de formulários e gera uma classe para o form escolhido
Option Public
Option Explicit
Use "lsArrayList.class"
Dim s As NotesSession
'LotusScript
'/*
' * Description: Testa se o ano é bissexto
' * Created: 20-03-2009
' * Author: William Madruga
' */
Function isLeapYear( ano As String) As Boolean
If (ano Mod 400 = 0) Then
isLeapYear = True
' LotusScript Code
'/**
' * Classe Replacer
' * @author Bjorn Cintra
' */
Public Class Replacer
Private m_arrFrom() As String
Private m_arrReplace() As String