This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prevent the backspace key from navigating back. | |
$(document).unbind('keydown').bind('keydown', function (event) { | |
var doPrevent = false; | |
if (event.keyCode === 8) { | |
var d = event.srcElement || event.target; | |
if ((d.tagName.toUpperCase() === 'INPUT' && | |
( | |
d.type.toUpperCase() === 'TEXT' || | |
d.type.toUpperCase() === 'PASSWORD' || | |
d.type.toUpperCase() === 'FILE' || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class Lazy<T> { | |
private volatile T value; | |
public T getOrCompute(Supplier<T> supplier) { | |
final T result = value; // Just one volatile read | |
return result == null ? maybeCompute(supplier) : result; | |
} | |
private synchronized T maybeCompute(Supplier<T> supplier) { | |
if (value == null) { | |
value = requireNonNull(supplier.get()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkill gvfs; GVFS_DEBUG=all GVFS_SMB_DEBUG=10 `find /usr/lib* -name 'gvfsd'` &> /tmp/log.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credits: Adam's answer in http://stackoverflow.com/a/20786262/69362 | |
// Paste this in browser's console | |
var $rootScope = angular.element(document.querySelectorAll("[ui-view]")[0]).injector().get('$rootScope'); | |
$rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeStart to '+toState.to+'- fired when the transition begins. toState,toParams : \n',toState, toParams); | |
}); | |
$rootScope.$on('$stateChangeError',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeError - fired when an error occurs during transition.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// inject inlined constants | |
angular.module('app.constants', []) | |
.constant('contextPath', '${pageContext.request.contextPath}'); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<beans> | |
<bean id="parent" abstract="true" class="example.ComplexObject"> | |
<property name="adminEmails"> | |
<props> | |
<prop key="administrator">[email protected]</prop> | |
<prop key="support">[email protected]</prop> | |
</props> | |
</property> | |
</bean> | |
<bean id="child" parent="parent"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Conceitos sobre arquitetura | |
http://randomactsofarchitecture.com/2012/11/20/should-software-architects-write-code/ | |
http://www.infoq.com/articles/brown-are-you-a-software-architect | |
http://www.joelonsoftware.com/items/2006/09/01.html | |
#Apresentação do Twitter sobre otimizações da JVM | |
http://www.slideshare.net/aszegedi/everything-i-ever-learned-about-jvm-performance-tuning-twitter | |
#Livros | |
Recomendações: http://pinterest.com/while42/pragmatic-programmer/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.target').on('dragover', function(event){ | |
event.preventDefault(); | |
}); | |
$('.target').on('drop', function(event){ | |
var id = event.originalEvent.dataTransfer.getData('id'); | |
}); | |
$('.souce').on('dragstart', function(event){ | |
var id = $(this).attr('id'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
idleTime = 0; | |
$(document).ready(function () { | |
//Increment the idle time counter every minute. | |
var idleInterval = setInterval(timerIncrement, 60000); // 1 minute | |
//Zero the idle timer on mouse movement. | |
$(this).mousemove(function (e) { | |
idleTime = 0; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var debug = true, | |
LOG = debug ? console.log.bind(console) : function () {}; |