Skip to content

Instantly share code, notes, and snippets.

View josepaiva94's full-sized avatar

José Carlos Paiva josepaiva94

View GitHub Profile
@josepaiva94
josepaiva94 / verifier.js
Created August 3, 2017 17:55
Link multiple OAuth providers to account by email address instead of creating new account (FeathersJS)
import Debug from 'debug';
import { Verifier } from 'feathers-authentication-oauth2';
const debug = Debug('feathers-authentication-emailfirstoauth2:verify');
class EmailFirstOAuth2Verifier extends Verifier {
constructor (app, options = {}) {
options.emailField = options.emailField || 'email';
super(app, options);
@josepaiva94
josepaiva94 / JarFileClassLoader.java
Created February 2, 2018 09:15
Utility to load classes from a JAR file
/**
* Utility to load classes from a JAR file
*/
public class JarFileClassLoader {
private static Map<String, JarFileClassLoaderCacheItem> urlClassLoadersCache = new HashMap<>();
@SuppressWarnings("unchecked")
public static <T> T initializeClassFromJar(String jarPath, String className)
throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
@josepaiva94
josepaiva94 / index.js
Created April 8, 2021 14:09
Bibtex to SQL (SoKMan)
const fs = require('fs');
const bibtexParse = require('bibtex-parse-js');
const _escapeString = function (val) {
val = val.replace(/[\0\n\r\b\t\\'"\x1a]/g, function (s) {
switch (s) {
case "\0":
return "\\0";
case "\n":
return "\\n";