Skip to content

Instantly share code, notes, and snippets.

View lpellegr's full-sized avatar
Enjoying life every second of the day

Laurent Pellegrino lpellegr

Enjoying life every second of the day
View GitHub Profile
@usergenic
usergenic / ce-fix.html
Created January 11, 2018 23:11
Workaround for LastPass's clobbering of createElement
<script>
document.createElement = Document.prototype.createElement;
</script>
@lpellegr
lpellegr / emergency-numbers.py
Last active May 9, 2017 16:04
Extract emergency numbers from the libphonenumber resource and create an immutable Java map based on country codes
#!/usr/bin/python3
from lxml import etree
import os
import tempfile
import urllib
JAVA_VARIABLE_NAME="emergencyNumberPerCountryCode"
PHONE_NUMBER_METADATA_URL="https://raw.githubusercontent.com/googlei18n/libphonenumber/master/resources/ShortNumberMetadata.xml"
@alex-shpak
alex-shpak / querydsl.gradle
Last active January 9, 2020 05:45
Gradle script for querydsl-apt processor with separate classpath
// apply plugin: 'idea'
sourceSets {
generated.java
main.java.srcDirs += generated.java.srcDirs
}
configurations {
querydslapt
}
@dcollien
dcollien / ImageTools.es6
Last active April 28, 2023 09:00
Resize Images in the Browser
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () {
try {
return Boolean(new Blob());
} catch (e) {
return false;
}
}());
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () {
try {
@ben-manes
ben-manes / ApiOriginFilter.java
Last active August 11, 2017 07:13
Swagger 1.5.1-M1 + RestEasy 3.x + Guice 4
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
@robdodson
robdodson / gist:bab25f5286d0ebc13c48
Last active June 9, 2017 14:12
polymer gravatar
<polymer-element name="user-gravatar" attributes="email">
<template>
<img src="https://secure.gravatar.com/avatar/{{gid}}" />
</template>
<script>
Polymer('user-gravatar', {
ready: function() {
this.gid = md5(this.email);
}
});
@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active March 15, 2024 06:39
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@whitfin
whitfin / LinkMovementMethod.java
Created January 28, 2014 21:09
Custom Link Movement to open any clicked links inside an inline browser. Requires either a custom inline browser, or the one I created in a gist.
package com.zackehh.example;
import com.zackehh.example.MinimalBrowser;
import android.content.Context;
import android.content.Intent;
import android.text.Layout;
import android.text.Spannable;
import android.text.method.MovementMethod;
import android.text.style.URLSpan;
@zach-klippenstein
zach-klippenstein / ChangePassword.java
Last active April 3, 2024 18:04
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall (rsdio@metastatic.org), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{