Skip to content

Instantly share code, notes, and snippets.

@aviflax
aviflax / kafka_uberjar.diff
Created January 29, 2016 18:24
Diff to apply to Kafka to build an Uberjar with Shadow
--- a/build.gradle
+++ b/build.gradle
@@ -18,12 +18,14 @@ import org.ajoberstar.grgit.Grgit
buildscript {
repositories {
mavenCentral()
+ jcenter()
}
apply from: file('gradle/buildscript.gradle'), to: buildscript
@aviflax
aviflax / Gemfile
Last active February 12, 2016 16:41
json-schema Custom Format Test
source 'https://rubygems.org'
gem 'json-schema', '~> 2.6'
@aviflax
aviflax / consumers.rb
Created February 18, 2016 21:29
JRuby Kafka Consumer Vendor using Confluent’s KafkaAvroDeserializer
require_relative './config'
java_import org.apache.kafka.clients.consumer.KafkaConsumer
java_import org.apache.kafka.clients.consumer.ConsumerConfig
# This class name must be in a string, apparently because it starts with io
java_import 'io.confluent.kafka.serializers.KafkaAvroDeserializer'
# We need to reuse consumers between requests because they maintain a buffer
# and a pool of TCP/IP connections to the Kafka nodes. This also provides a
@aviflax
aviflax / resources.md
Created June 1, 2016 21:04
Resources for Learning Data Science
@aviflax
aviflax / ruby.md
Created September 8, 2016 17:35
My Development Notes and FAQs

My Development Notes and FAQ for Ruby

Explicit return of nil

I often end a function with an explicit nil.

This is something I do frequently: when the purpose of a function is its side effects, and it’s not meant to have a meaningful return value, I generally ensure that the function returns nil, rather than some other value.

In this case, I believe that the result value of the assignment expression in the prior statement is true; without the explicit nil then, this function would return true. But that wouldn’t actually be meaningful and I wouldn’t want anyone using this function to start using its return value for anything. Returning nil helps make clear, I hope, that the whole point of this function is to have side effects.

@aviflax
aviflax / lambda.go
Created July 14, 2015 19:49
Proof of concept for using Go with Lambda
// Package lambda helps create workers that run in AWS’ Lambda service.
// The Lambda service is designed to run Node.js programs, so we have a very thin
// Node.js wrapper which is essentially an adapter between our Go worker programs
// and Lambda. Lambda runs our Node.js wrapper/adapter which then in turn runs
// our Go worker programs as child processes, communicating with them via stdio pipes
// and Unix exit codes.
//
// The interaction between the Lambda wrapper and our Go programs works like this:
//
// * The Node.js function is invoked by Lambda. Lambda passes an `event` parameter to
module Func
def self.my(mod)
mod.constants(false)
.map { |const_name| { const_name.downcase => mod.const_get(const_name) } }
.reduce(:merge)
.select { |_name, val| val.lambda? }
.each { |name, op| mod.define_singleton_method name, op }
nil
end
end

I suck at marketing, but off the top of my head, some thoughts based on your home page:

  1. “Civilized discussion” is spot on for public communities, but I suspect businesses would be far more interested in something along the lines of “organized, findable discussions” — emphasizing how Discourse is better than of email and chat.
    1. I.E. it’d be worthwhile to find a tagline that somehow captures the value proposition of Discourse in both public and private domains.
  2. The copy “Hang out and have searchable public conversations” is not right for businesses. They don’t want to hang out, and they don’t want their conversations public.
  3. All the examples in the Who's using it section and in the Customers page are public communities. It would be helpful if a few of those were businesses.
[image-uploader-2786760420-zk2m8 image-uploader] 26302356 [StreamThread-21] INFO org.apache.kafka.clients.consumer.internals.AbstractCoordinator - Marking the coordinator kafka-3.parkassist.com.:9092 (id: 2147483644 rack: null) dead for group image-uploader
[image-uploader-2786760420-zk2m8 image-uploader] 26302471 [StreamThread-21] INFO org.apache.kafka.clients.consumer.internals.AbstractCoordinator - Discovered coordinator kafka-3.parkassist.com.:9092 (id: 2147483644 rack: null) for group image-uploader.
[image-uploader-2786760420-zk2m8 image-uploader] 26302475 [StreamThread-21] INFO org.apache.kafka.clients.consumer.internals.AbstractCoordinator - (Re-)joining group image-uploader
[image-uploader-2786760420-zk2m8 image-uploader] 26302777 [StreamThread-63] INFO org.apache.kafka.clients.consumer.internals.AbstractCoordinator - Marking the coordinator kafka-3.parkassist.com.:9092 (id: 2147483644 rack: null) dead for group image-uploader
[image-uploader-2786760420-zk2m8 image-uploader] 26302784 [StreamT
$ npm install -g bower
npm WARN deprecated bower@1.8.0: ..psst! While Bower is maintained, we recommend Yarn and
Webpack for *new* front-end projects! Yarn's advantage is security and reliability, and
Webpack's is support for both CommonJS and AMD projects. Currently there's no migration
path, but please help to create it: https://github.com/bower/bower/issues/2467