Skip to content

Instantly share code, notes, and snippets.

View bbottema's full-sized avatar

Benny Bottema bbottema

View GitHub Profile
@LenarBad
LenarBad / ReadFileIntoStringGuava.java
Created December 5, 2017 19:44
How to read file into String with Google Guava
public String getFileIntoStringGuava(String fileName) throws IOException {
InputStream input = this.getClass().getResourceAsStream("/" + fileName);
return CharStreams.toString(new InputStreamReader(input, StandardCharsets.UTF_8));
}
@michaelajr
michaelajr / pom.xml
Last active July 27, 2023 17:06
Setup for the maven-gpg-plugin. Fix for "signing failed: Inappropriate ioctl for device".
<?xml version="1.0" encoding="UTF-8"?>
<!--
*
* pom.xml fragment for setting up GPG signing.
*
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
@alvarow
alvarow / openssl-cheat.sh
Last active April 11, 2024 04:30
OpenSSL and Keytool cheat sheet
# Generate a new key
openssl genrsa -out server.key 2048
# Generate a new CSR
openssl req -sha256 -new -key server.key -out server.csr
# Check certificate against CA
openssl verify -verbose -CApath ./CA/ -CAfile ./CA/cacert.pem cert.pem
# Self Signed
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@xeoncross
xeoncross / ajax.js
Last active August 3, 2023 06:06
Simple, cross-browser Javascript POST/GET xhr request object. Supports request data and proper AJAX headers.
/**
* IE 5.5+, Firefox, Opera, Chrome, Safari XHR object
*
* @param string url
* @param object callback
* @param mixed data
* @param null x
*/
function ajax(url, callback, data, x) {
try {
@PizzaBrandon
PizzaBrandon / jquery.waituntilexists.js
Last active August 24, 2023 14:23 — forked from buu700/jquery.waituntilexists.js
Updated waitUntilExists plugin
;(function ($, window) {
var intervals = {};
var removeListener = function(selector) {
if (intervals[selector]) {
window.clearInterval(intervals[selector]);
intervals[selector] = null;
}
@eighteyes
eighteyes / Default (OSX).sublime-mousemap
Created September 18, 2012 17:20
Enable Mouse Wheel Zoom in SublimeText 2 on MacOSX (Place in User Folder)
[
{ "button": "scroll_down", "modifiers": ["ctrl"], "command": "increase_font_size" },
{ "button": "scroll_up", "modifiers": ["ctrl"], "command": "decrease_font_size" }
]
@rponte
rponte / StringUtils.java
Last active April 10, 2024 23:01
Removing accents and special characters in Java: StringUtils.java and StringUtilsTest.java
package br.com.triadworks.rponte.util;
import java.text.Normalizer;
public class StringUtils {
/**
* Remove toda a acentuação da string substituindo por caracteres simples sem acento.
*/
public static String unaccent(String src) {