Skip to content

Instantly share code, notes, and snippets.

@worace
worace / SQLengine.markdown
Last active September 21, 2015 21:11
Possible Mod 4 short projects

SQL Engine

Remember our old buddy Sales Engine? It just won't die. The original clients from the sales engine project have returned, this time requesting more Business Intelligence features. Our original SalesEngine was starting to push the bounds of what we could do efficiently in pure ruby, so our new implementation is going to require some updated tech.

This time around we'll implement sales engine using a database with ActiveRecord. This will allow us to offload some of that complicated business logic where it belongs -- in a relational databse. But steel yourselves, since this new implementation will require writing some SQL.

  • Library/CLI only (no web ui?)
  • Spec harness?
  • New BI reqs?
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

The installation directions for marvel -- a plugin for elastic search -- is very scant and unnecessarily indirect. The clearest instructions I found on how to install the marvel plugin through homebrew was on Twitter! Twitter! Why?! Anyways, to install marvel via brew, you can do this:

brew update
brew upgrade elasticsearch
cd /usr/local/Cellar/elasticsearch/<whatever version>
bin/plugin -i elasticsearch/marvel/latest

Welcome to Phalka Posse!

Mission: Create intentional independet positive change

Phalka at Turing:

  • Tuesdays: come eat lunch
  • Fridays: Spikes will be dedicated to project work time or speakers or panels

Phalka outside of Turing

  • As these events come up you'll be notified
@ThisIsMissEm
ThisIsMissEm / handler.js
Created November 25, 2014 18:53
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
@klpx
klpx / splitEither.scala
Last active June 18, 2019 16:25
Akka Streams. Graph for Split Either[L,R] to L and R flows
/**
Copy left Alexander Hasselbach
Usage:
val E = b.add(splitEither[Throwable,Int])
val parsed = b.add(Flow[Either[Throwable,Int]])
val valids = b.add(Flow[Int])
val invalids = b.add(Flow[Throwable])
def graphql: Endpoint[Json] = {
post(
"graphql" ? (body :: authOptReader :: contentTypeReader :: imageOptReader :: queryReader :: variablesReader)
){ (body: String, authOpt: Option[TokenUUID], contentType: String, image: Option[FileUpload], query: Option[String], variables: Option[String]) =>
contentType.take("multipart/form-data".length) match {
case "multipart/form-data" => {
for {
auth <- getAuthorization(authOpt)
@zimmicz
zimmicz / server.js
Created August 6, 2017 16:25
PostGIS MVT Express routing
const express = require("express")
const app = express()
const { Pool } = require("pg")
const SphericalMercator = require("sphericalmercator")
const pool = new Pool({
host: "localhost",
port: 15432,
user: "postgres",
database: "postgres"
})
@urschrei
urschrei / latlon_to_bng.py
Last active December 27, 2019 16:29
A function to convert WGS84 lat, long points to BNG (OSGB36) Eastings and Northings. Based entirely on code by Hannah Fry: http://hannahfry.co.uk/2012/02/01/converting-british-national-grid-to-latitude-and-longitude-ii/
import math
def bng(input_lat, input_lon):
"""
Convert WGS84 lat and long (ie. from GPS) to OSGB36 (BNG)
Expects two floats as input
Returns a tuple of Easting, Northing floats
Accurate to ~5m
For testing purposes: