Skip to content

Instantly share code, notes, and snippets.

View lsamayoa's full-sized avatar

Leonel Samayoa lsamayoa

View GitHub Profile
@lsamayoa
lsamayoa / gist:16f465755148f049eb6c
Created July 10, 2015 12:53
Int not set getter test
public class NotSetIntGetterTest {
private int doNotSet;
public int getDoNotSet(){
return doNotSet;
}
public static void main(String[] args) {
int result = 0;
@lsamayoa
lsamayoa / gist:c7252aa4163612c3aac2
Last active August 29, 2015 14:24
Var declaration inside or outside loop comparision
// javap -Xbatch \
// -XX:-TieredCompilation \
// -XX:+PrintCompilation \
// Main \
// 2> /dev/null
// 71 1 b java.lang.String::hashCode (55 bytes)
// 80 2 b java.lang.String::indexOf (70 bytes)
// 94 3 b sun.nio.cs.UTF_8$Encoder::encode (359 bytes)
// 98 4 b java.io.BufferedInputStream::getBufIfOpen (21 bytes)
// 99 5 s b java.io.BufferedInputStream::read (49 bytes)
@lsamayoa
lsamayoa / gist:130dbcc86f99d1b8ee87
Created July 8, 2015 15:08
Final Keyworkd advantage on single use variable
// # JMH1.10.1(released 13 days ago)
// # VM invoker:/Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home/bin/java
// # VM options:-Didea.launcher.port=7536-Didea.launcher.bin.path=/Applications/IntelliJ-IDEA-14.app/Contents/bin-Dfile.encoding=UTF-8
// # Warmup:1 iterations,1 s each
// # Measurement:5 iterations,1 s each
// # Timeout:10 min per iteration
// # Threads:1 thread,will synchronize iterations
// # Benchmark mode:Average time,time/op
// # Benchmark:com.xoom.api.client.l10n.FinalKeywordBenchmark.MainBenchmark.finalBenchmark
//
@lsamayoa
lsamayoa / gist:dfbd121d53bfe884a270
Created August 11, 2014 20:28
Base Gulpfile RAW copy of production code
var gulp = require('gulp'),
gutil = require('gulp-util'),
connect = require('gulp-connect'),
watch = require('gulp-watch'),
less = require('gulp-less'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
ngmin = require('gulp-ngmin'),
autoprefixer = require('gulp-autoprefixer'),
@lsamayoa
lsamayoa / ExpandableCountriesSelector
Created June 21, 2013 16:38
A simple 10 mins jquery based expandable countries selector. Ex: http://jsfiddle.net/leonel0101/UyfxM/6/
$(function () {
var makeExpandableCountriesSelector = function (selector, def, aditional) {
// LOCAL CONSTANTS
var LESS_VALUE = 'less',
MORE_VALUE = 'more';
// Our model
var countries = def,
more = true,
less = false;