Skip to content

Instantly share code, notes, and snippets.

View ChainedList.java
package org.foo.chainedlist;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;
import org.apache.commons.collections4.IterableUtils;
View disable-pageview-api.js
/// disable-pageview-api.js
// Based on: https://addons.mozilla.org/firefox/addon/disable-page-visibility/
// License: http://www.opensource.org/licenses/bsd-license.php
(function(){
// visibilitychange events are captured and stopped
document.addEventListener("visibilitychange", function(e) {
e.stopImmediatePropagation();
}, true);
// document.visibilityState always returns false
Object.defineProperty(Document.prototype, "hidden", {
View withintest.sh
#!/bin/bash
# Check if the current time falls within defined time range on UNIX
#set -e
set -o pipefail
function errtrap { es=$?; echo "ERROR line $1: Command exited with status $es.">&2; exit 1; }; trap 'errtrap $LINENO' ERR
#export TZ=Asia/Kolkata
@basinilya
basinilya / Modulegen.java
Created Feb 8, 2020
Generate jboss-cli "module add" command for a jar with recursive Class-Path dependencies
View Modulegen.java
package org.foo.modulegen;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
View CoalescingProperties.java
package org.foo.testproxy;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
View EclipseExtractConstant.java
public class EclipseExtractConstant {
private static final int _42 = 42;
private static final String STRINGWITH_SPECIAL_CHARACTERS = "string€with%special†characters/\\!";
private static final String _100STRINGSSTARTSWITHNUMBER = "100stringsstartswithnumber";
private static final String STRING_WITH_SPACES = "string with spaces";
public static void main(final String[] args) {
System.out.println(x(STRINGWITH_SPECIAL_CHARACTERS));
System.out.println(x(_100STRINGSSTARTSWITHNUMBER));
View AbstractPushingCsvParser.java
package org.foo.csvtokenizer;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractPushingCsvParser implements PushingCsvParser {
@Override
@basinilya
basinilya / .gitattributes
Last active Jul 7, 2019
restart-wifi-ap.bat: Solve hostednetwork failing after sleep by restarting the physical adapter
View .gitattributes
# Auto detect text files and perform LF normalization
* text=auto
# Windows CMD does not like LF in batch files
*.bat text eol=crlf
*.cmd text eol=crlf
@basinilya
basinilya / MyLoggerFormatter.java
Last active Jul 27, 2019
Custom MessageFormat for java.util.logging
View MyLoggerFormatter.java
package org.foo.myloggerformatter;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.Format;
import java.text.MessageFormat;
import java.text.ParsePosition;
import java.util.Date;
View Jdbc2Mf.java
package org.foo.jdbc2mf;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.Format;
import java.text.MessageFormat;
import java.text.ParsePosition;
import java.util.Date;
import java.util.Locale;