Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Leo Dutra leodutra

🏠
Working from home
View GitHub Profile
@leodutra
leodutra / supports-post-object.js
Last active Aug 29, 2015
Check if HTML5 postMessage supports object serialization.
View supports-post-object.js
var supportsPostObject = false;
(function(win){
if (window.postMessage) {
var oldIE = false;
var callback = function(e) {
supportsPostObject = typeof(e.data) !== 'string';
@leodutra
leodutra / delete-stuff.bat
Last active Aug 29, 2015
Batch for deleting files and folders recursively on Windows.
View delete-stuff.bat
@echo off
set foldername=%1
:: Remove files before removing their folders. It's faster
DEL /F /Q /S %foldername%\*
:: "RD" is much more fast than "RMDIR"
for /D %%i in ("%foldername%\*") do RD /S /Q "%%i"
@leodutra
leodutra / data-fill-till-bottom.js
Created Feb 12, 2015
Data-attribute bind functionality: fill available window area using the target element.
View data-fill-till-bottom.js
// RECOMENDAVEL UTILIZAR $().ready JA EXISTENTE
$(document).ready(function() {
var $filler = $('[data-fill-till-bottom]');
$filler.height($(window).height() - $filler.offset().top);
});
@leodutra
leodutra / db2-odbc-config.sh
Last active Aug 29, 2015
Simple NodeJS/IOJS ODBC DB2 config Ubuntu 14.04
View db2-odbc-config.sh
# first download and install IBM Data Server Driver Package CLI/Packages
apt-get install iojs npm git unixodbc unixodbc-dev -y
git clone git://github.com/wankdanker/node-odbc.git
cd node-odbc
node-gyp configure build
npm install odbc
@leodutra
leodutra / ubuntu-14-subclipse-1.10-tutorial.txt
Last active Aug 29, 2015
Configure JavaHL 1.8 for Subclipse 1.10
View ubuntu-14-subclipse-1.10-tutorial.txt
// reference: http://subclipse.tigris.org/wiki/JavaHL
Install inside RAD 8.5:
http://subclipse.tigris.org/update_1.10.x
Install JavaHL dependencies:
sudo apt-get install libsvn-java -y
Find installation path
sudo find / -name libsvnjavahl-1.so
@leodutra
leodutra / first-input-focus.js
Last active Aug 29, 2015
Focus first form input field using jQuery
View first-input-focus.js
function focusFirstInput($root) {
$(':input', $root).not('[type="hidden"], button').first().focus();
}
@leodutra
leodutra / ubuntu-14.04-netspeed-indicator.sh
Created Apr 28, 2015
Netspeed indicator for Ubuntu 14.04
View ubuntu-14.04-netspeed-indicator.sh
# 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 / eclipse-rad-swt-process-browser-fix
Created May 8, 2015
Eclipse/RAD SWT Browser Path Error Fix
View eclipse-rad-swt-process-browser-fix
Q: What do I need to run the SWT Browser in a standalone application on Linux or Solaris?
A: Follow the steps below to use the SWT Browser widget in your standalone SWT application.
A supported native browser must be installed (linux requirements) (solaris requirements).
If a supported WebKitGTK and/or XULRunner is installed then it should be found automatically at runtime with no additional effort. For other native Mozilla-based browsers:
Set the environment variable MOZILLA_FIVE_HOME to the native browser's installation folder. e.g. setenv MOZILLA_FIVE_HOME /usr/lib/mozilla
Set the environmnent variable LD_LIBRARY_PATH to include MOZILLA_FIVE_HOME. e.g. setenv LD_LIBRARY_PATH ${MOZILLA_FIVE_HOME}:${LD_LIBRARY_PATH}
Your standalone SWT application can now use the Browser widget.
http://www.eclipse.org/swt/faq.php#browserlinuxrcp
@leodutra
leodutra / remove-backup-tilde-linux.sh
Created May 10, 2015
Remove GEdit Linux Text Editor Tilde Backup Files (ended with "~")
View remove-backup-tilde-linux.sh
cd /home
rm -i `find -name '*~'`