Skip to content

Instantly share code, notes, and snippets.

// Simple bulk only Gateway
// url is for DR (Delivery Reports)
case class Service(name: String, url: String)
// Params your API gets in
case class HttpMessage(service: String, originator: String, msisdn: String, body: String)
// Handles MT's and MO's (maybe should contain service name for sake of simplicity)
case class MQMessage(guid: String, msisdn: String, originator: String, body: String)
// Types of DR's you could send
@JakubOboza
JakubOboza / gist:463586d764287971fc6c28a3f85294b3
Created May 17, 2016 12:51
Riak issue with upgrade from old -sname rings to new -name rings.
Dear Team
What are we trying to do:
We are trying to change -sname to -name within our existing cluster without taking the cluster down.
We had a call with basho and we were advised to take steps like here:
http://docs.basho.com/riak/1.4.9/ops/running/nodes/renaming/#Multi-Node-Clusters
They didn't work.
data Configuration =
Configuration { path :: String,
localhost :: String,
remotehost :: String,
isguest :: Bool,
issuperuser :: Bool,
currentdir :: String,
homedir :: String,
timeconnected :: Integer
}
require 'minitest/autorun'
# Money are in floats for simplicity, it should be bigint
# Promotions are prioritized in order [A,B] => A rule is applied first, B rule is applied second
class Item
attr_accessor :name, :price, :product_code
def initialize(name, price, product_code)
@name = name
@price = price
@JakubOboza
JakubOboza / try_out_browser.scala
Last active August 29, 2015 14:05
super simple web browser using javafx.
import javafx.application.Application
import javafx.geometry.HPos
import javafx.geometry.VPos
import javafx.scene.Node
import javafx.scene.Scene
import javafx.scene.layout.HBox
import javafx.scene.layout.Priority
import javafx.scene.layout.Region
import javafx.scene.paint.Color
import javafx.scene.web.WebEngine

Sinatra like Web Framework for Scala

I tried few solutions like Scalatra, Play and for my POV Scalatra was a bit too bloated and big, didn't feel like sinatra at all. Play is more like Rails so you get everything. But spark is simple and easy to udnerstand. I didn't see any Scala example so i made one.

Sadly there are few things i don't like :(

If we would build DSL in a different way eg. we could have it like this:

 get(Route("/hello"){
namespace :deploy do
task :starting do
invoke 'deploy:check'
end
task :updating => :new_release_path do
invoke "#{scm}:create_release"
invoke 'deploy:symlink:shared'
end
@JakubOboza
JakubOboza / pebble.rb
Created March 15, 2014 19:36
if you need a quick check on riak buckets
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require 'riak'
require 'optparse'
options = {}
OptionParser.new do |opts|
import Prelude
import Control.Exception
main = do
input <- getLine
let parsedNum = (read input::Double)
result <- try (print parsedNum) :: IO (Either IOException ())
case result of
Right () -> putStrLn "Great Success! "
Left e -> do
@JakubOboza
JakubOboza / main.hs
Created December 5, 2013 09:47
lulz on forkIO
{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
module Main (main) where
import Database.Redis
import Control.Concurrent
import Control.Concurrent.Chan
import Data.ByteString.Char8 as B
import Control.Monad.IO.Class
import Control.Monad