Skip to content

Instantly share code, notes, and snippets.

View leodutra's full-sized avatar
🦙
Llama and other LLMs

Leo Dutra leodutra

🦙
Llama and other LLMs
View GitHub Profile
@leodutra
leodutra / iframe-reference.html
Last active August 29, 2015 14:00
IFrame Default Attributes Reference + Scroll Definition (IE 8- Fix)
<!--
seamless="seamless" - Specifies that the <iframe> should look like it is a part of the containing document
allowTransparency="true" - old "seamless" alternative (is not a W3C spec/ option)
frameborder="0" - no border on old browsers (deprecated on HTML5)
scrolling="auto" - Specifies whether or not to display scrollbars in an <iframe> (deprecated on HTML5)
horizontalscrolling - force hide horizontal scrolling on (IE fix)
verticalscrolling - force hide vertical scrolling on (IE fix)
AUTO RESIZE IFRAME
https://github.com/davidjbradshaw/iframe-resizer
@leodutra
leodutra / fullEncodeURI.js
Last active August 29, 2015 14:05
Fully Encode URI/URL
function fullEncodeURI(str) {
if (str !== undefined && str !== null) {
str = '' + str;
var res = '';
for(var i = 0, l = str.length; i < l ;) {
res += '%';
res += str.charCodeAt(i++).toString('16');
}
return res;
}
@leodutra
leodutra / first-input-focus.js
Last active August 29, 2015 14:19
Focus first form input field using jQuery
function focusFirstInput($root) {
$(':input', $root).not('[type="hidden"], button').first().focus();
}
@leodutra
leodutra / ubuntu-14.04-netspeed-indicator.sh
Created April 28, 2015 22:47
Netspeed indicator for Ubuntu 14.04
# http://www.edivaldobrito.com.br/como-instalar-o-applet-netspeed-indicator-ubuntu-14-04/
add-apt-repository ppa:nilarimogard/webupd8
apt-get update
apt-get install indicator-netspeed
@leodutra
leodutra / remove-backup-tilde-linux.sh
Created May 10, 2015 00:15
Remove GEdit Linux Text Editor Tilde Backup Files (ended with "~")
cd /home
rm -i `find -name '*~'`
@leodutra
leodutra / JNDIURLAccessTag.java
Last active August 29, 2015 14:21
JNDI URL Lookup TagLib para WAS6
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 / getGlobalOffset.js
Created May 5, 2012 03:30
Gets HTMLElement Global Offset Left/Top (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 October 5, 2015 04:55
Clean IBM WebSpherere 7 temp and log files
#!/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 October 6, 2015 19:28
Very fast left pad, anything (JavaScript)
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 October 8, 2015 18:45
Check disk space linux command line (cli)
df -h
#or
df -k