Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Leo Dutra leodutra

🏠
Working from home
View GitHub Profile
@leodutra
leodutra / JNDIURLAccessTag.java
Last active Aug 29, 2015
JNDI URL Lookup TagLib para WAS6
View JNDIURLAccessTag.java
package com.github.leodutra.util.tag.JNDIURLAccessTag;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
@leodutra
leodutra / .xsessionrc
Created Jun 18, 2015
Lenovo Thinkpad E430 Ubuntu 14.04 keyboard layout slash fix pt-br
View .xsessionrc
#!/bin/bash
# add this file to your /home
setxkbmap -model thinkpad60 -layout br
@leodutra
leodutra / feed-js-from-static.jsp
Last active Sep 24, 2015
How to receive, store and feed functions with static server text ( HTML / JSP / ASP / JavaScript / Struts / whatever )
View feed-js-from-static.jsp
<s:iterator value="fieldErrors"> <script type="text/plain" data-is-error-msg><s:property value="value[0]" /></script></s:iterator>
<s:iterator value="actionErrors"><script type="text/plain" data-is-error-msg><s:property /></script></s:iterator>
<s:iterator value="actionMessages"><script type="text/plain" data-is-warning-msg><s:property /></script></s:iterator>
<script>
// BusinessExceptions -> utils.message
$(document).ready(function() {
$('[data-is-error-msg]').each(function() { utils.message.error.send($(this).text()); });
$('[data-is-warning-msg]').each(function() { utils.message.warn.send($(this).text()); });
});
</script>
@leodutra
leodutra / getGlobalOffset.js
Created May 5, 2012
Gets HTMLElement Global Offset Left/Top (JS)
View getGlobalOffset.js
function getGlobalOffset(el) {
var x = 0, y = 0
while (el) {
x += el.offsetLeft
y += el.offsetTop
el = el.offsetParent
}
return { left: x, top: y }
}
@leodutra
leodutra / clean-websphere-7.sh
Last active Oct 5, 2015
Clean IBM WebSpherere 7 temp and log files
View clean-websphere-7.sh
#!/bin/sh
WAS_7_PATH=/opt/IBM/WebSphere/AppServer70
MAIN_PROFILE=$WAS_7_PATH/profiles/AppSrv01/
rm -Rf $WAS_7_PATH/temp/*
rm -Rf $WAS_7_PATH/logs/*
rm -Rf $MAIN_PROFILE/temp/*
rm -Rf $MAIN_PROFILE/wstemp/*
rm -Rf $MAIN_PROFILE/config/temp/*
@leodutra
leodutra / leftPad.js
Last active Oct 6, 2015
Very fast left pad, anything (JavaScript)
View leftPad.js
leftPad = function leftPad(value, size, pad) { // very very fast
if (value.length < size) {
size -= value.length;
var res = '';
for(;;) {
if (size & 1) res += pad;
size >>= 1;
if (size) pad += pad;
else break;
}
@leodutra
leodutra / check-disk-space.sh
Created Oct 8, 2015
Check disk space linux command line (cli)
@leodutra
leodutra / getAbsolutePath.js
Created Sep 19, 2012
Get Absolute Path (JavaScript)
View getAbsolutePath.js
function getAbsolutePath(url) {
return url.match(/^\w+:\/\/[^\/]+\/*(?:[^\/\.]+(?:\r|\/+))*/)[0];
}
@leodutra
leodutra / additional-options
Last active Oct 15, 2015
IBM WAS - Websphere Application Server 7 - Install options for Ubuntu
View additional-options
-OPT PROF_enableService="true"
-OPT PROF_serviceUserName="websphere"
@leodutra
leodutra / filter-blur.css
Created May 19, 2015
Cross-browser Filter Blur CSS
View filter-blur.css
filter: blur(5px); /* Someday, sigh ... */
-webkit-filter: blur(5px); /* Prefixed CSS3 blur filters */
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
/* filter: url(#blur); Firefox needs SVG */
filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius='10'); /* IE lte 9 */