Skip to content

Instantly share code, notes, and snippets.

View jjbubudi's full-sized avatar
😀
Learning

Jimmy Au jjbubudi

😀
Learning
  • Vancouver, Canada
View GitHub Profile
package yourpackage.util.hibernate.multitenancy;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.service.config.spi.ConfigurationService;
import org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider;
import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider;
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
xmlns:http="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd
@jjbubudi
jjbubudi / reset.sh
Created October 21, 2014 15:30
Reset Mac LaunchPad
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
@jjbubudi
jjbubudi / clone.php
Last active August 29, 2015 14:14
Guava clone
$subscriberClass = new \ReflectionClass(TestSubscriber::class);
$annotationReader = new AnnotationReader();
$mappings = [];
// Registry
foreach ($subscriberClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
$annotation = $annotationReader->getMethodAnnotation($method, Subscribe::class);
$parameters = $method->getParameters();
if (!$annotation || empty($parameters)) {
@jjbubudi
jjbubudi / cloud_config
Last active August 29, 2015 14:25 — forked from rosskukulinski/cloud_config
CoreOS cloud_config for Rackspace Public Cloud
#cloud-config
coreos:
fleet:
public-ip: $public_ipv4
metadata: region=dfw,provider=rackspace
etcd:
discovery: https://discovery.etcd.io/youridhere
# multi-region and multi-cloud deployments need to use $public_ipv4
# We'll actually fill this in using fixup_etc.sh (see below)
# addr: $rax_privatenet_ipv4:4001
DELIMITER ;;
DROP FUNCTION IF EXISTS shard_nextval;;
CREATE FUNCTION shard_nextval() RETURNS BIGINT
BEGIN
INSERT INTO shard_seq VALUES (NULL);
SET @R_ObjectId_val = LAST_INSERT_ID();
DELETE FROM shard_seq;
RETURN @R_ObjectId_val;
END;;
#cloud-config
coreos:
etcd2:
discovery: https://discovery.etcd.io/<token>
advertise-client-urls: http://$private_ipv4:2379, http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380
listen-client-urls: http://0.0.0.0:2379, http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380, http://$private_ipv4:7001
fleet:
@jjbubudi
jjbubudi / TypedDictionary.swift
Created September 6, 2016 21:25
Typed Dictionary in Swift
public struct Key<T> {
let id: String
private let type: T.Type = T.self
}
extension Key: Hashable {
public var hashValue: Int {
get {
return self.id.hashValue ^ "\(self.type)".hashValue
}
var l = l || {}, m = this;
function n(a) {
return "string" == typeof a;
}
function p(a, b) {
a = a.split(".");
b = b || m;
for (var c = 0; c < a.length; c++) {
if (b = b[a[c]], null == b) {
return null;
function provideToExport(file, api, options) {
const j = api.jscodeshift;
const root = j(file.source);
return root
.find(j.ExpressionStatement, {
expression: {
type: "CallExpression",
callee: {
object: {
name: "goog"