Skip to content

Instantly share code, notes, and snippets.

View gioiab's full-sized avatar

Gioia Ballin gioiab

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gioiab on github.
  • I am gballin (https://keybase.io/gballin) on keybase.
  • I have a public key ASAKZjj3hGwci-Eyeu_lM7_plSmM9MYqsmE0TCKc1pmvGgo

To claim this, I am signing this object:

@gioiab
gioiab / smiley.rb
Created April 8, 2016 17:01
Measurence Engineering Blog - Representing the range of percentage variations from very bad to very good with emojis
def smiley(variation)
if variation < -15
":rage:"
elsif variation >= -15 && variation <= -2
":disappointed:"
elsif variation > -2 && variation < 2
":neutral_face:"
elsif variation >= 2 && variation <= 15
":slightly_smiling_face:"
else
@gioiab
gioiab / send_weekly_report.rb
Created April 8, 2016 16:56
Measurence Engineering Blog - How we send the weekly report to Slack via slack-poster
require 'googlecharts'
class Slack::Report::Weekly < Slack::Report::Base
# prepares a message for the weekly visits
def visits
return no_data if @weekly_report.count == 0
attachment = {
mrkdwn_in: ["text",
"title",
@gioiab
gioiab / sending_msg_slack_poster.rb
Created April 8, 2016 16:54
Measurence Engineering Blog - Sending a message with the slack-poster gem
poster = Slack::Poster.new(ENV['SLACK_HOOK'])
message = { text: "Hello slack!" }
poster.send_message(message)
@gioiab
gioiab / post_to_custom_channel.sh
Created April 8, 2016 16:36
Measurence Engineering Blog - Command for posting a message to a custom hook channel
curl -X POST \
-H 'Content-type: application/json' \
--data '{"channel": "#my-channel", "text":"Hello Slack"}' \
https://hooks.slack.com/services/T.../B.../...
@gioiab
gioiab / post_to_default_channel.sh
Created April 8, 2016 15:49
Measurence Engineering Blog - Command for posting a message to the default hook channel
curl -X POST \
-H 'Content-type: application/json' \
--data '{"text":"Hello Slack"}' \
https://hooks.slack.com/services/T.../B.../...
@gioiab
gioiab / FunSets.scala
Last active February 15, 2016 13:39
Learning Scala - Solution to the 2nd week assignment
package funsets
import common._
/**
* 2. Purely Functional Sets.
*/
object FunSets {
/**
* We represent a set by its characteristic function, i.e.
@gioiab
gioiab / recfun.scala
Created February 15, 2016 11:55
Learning Scala - Solution to the 1st week assignment
package recfun
import common._
import scala.annotation.tailrec
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
for (col <- 0 to row)