This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Initials { | |
private String foo = null; | |
private int i = 0; | |
private Map<String, Integer> map = null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fragment | |
case "say": | |
// can we get this to work using the existing type from the map? | |
responsePrototypePtr := responseRegistry["say"] | |
log.Printf("responsePrototypePtr %s is at addr %p", reflect.TypeOf(responsePrototypePtr), responsePrototypePtr) | |
// allocate a new response based off of prototype | |
// this allocates a **Response | |
responseObjPtr := reflect.New(reflect.TypeOf(&responsePrototypePtr)).Interface() | |
log.Printf("responseObjPtr type %s, string %s", reflect.TypeOf(responseObjPtr), responseObjPtr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.base.Strings; | |
import org.apache.commons.lang3.StringUtils; | |
import redis.clients.jedis.Jedis; | |
import redis.clients.jedis.JedisPool; | |
import redis.clients.jedis.exceptions.JedisConnectionException; | |
import redis.clients.jedis.exceptions.JedisDataException; | |
import java.util.Random; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VolatileDoubleCheck { | |
private final Object resourceLock = new Object(); | |
private volatile Resource resource; // the thing we want to make sure we only have 1 of, marked as volatile | |
public Resource getResource() { | |
if (resource == null) { | |
synchronized(resourceLock) { | |
if (resource == null) { | |
resource = new Resource(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const | |
program = require('commander'), | |
aws = require('aws-sdk'); | |
aws.config.update({region: 'us-east-1'}); | |
const sqs = new aws.SQS() | |
program.version(module.exports.version); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Slf4j | |
public class TWR implements Closeable() { | |
public void kaboom() throws IOException { | |
log.info("kaboom"); | |
throw new IOException("io exception here"); | |
} | |
@Override | |
public void close() { | |
log.warn("CLOSED!!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Slf4j | |
@EnableSwagger2 | |
@SpringBootApplication | |
@EnableScheduling | |
@SuppressWarnings("unused") | |
public class Application extends SpringBootServletInitializer { | |
/** | |
* Create our JDBI singleton. Configure plugins. Set options, pooling, etc. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const winston = require('winston'); // 3.1.0 | |
const winston_es = require('winston-elasticsearch'); // 0.7.7 | |
const util = require('./lib/util.js'); | |
var logger; | |
var transport; | |
// see https://github.com/vanthome/winston-elasticsearch/issues/17#issuecomment-463717315 | |
winston_es.prototype.close = async function () { | |
console.log("closing winston_es"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const winston = require('winston'), | |
_ = require('lodash'), | |
moment = require('moment'), | |
Transport = require('winston-transport'), | |
elasticsearch = require('elasticsearch'); | |
module.exports = class SimpleElasticsearch extends Transport { | |
constructor(opts) { | |
super(opts); | |
this.name = 'simple_elasticsearch'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================================ | |
// Copyright 2006-2010 Daniel W. Dyer | |
// | |
// 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 |
OlderNewer