Skip to content

Instantly share code, notes, and snippets.

@lvella
lvella / usahifen.py
Last active May 23, 2018 21:20
Decide se deve-se ou não usar hífen ao escrever uma palavra com prefixo em português.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Baseado nas regras do documento oficial:
# https://www2.senado.leg.br/bdsf/bitstream/handle/id/508145/000997415.pdf?sequence=1
import sys
import unicodedata
def base(l):
@justmoon
justmoon / custom-error.js
Last active April 22, 2024 17:19 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@inexplicable
inexplicable / akka-zk-cluster.scala
Created March 26, 2014 00:59
cluster backed by zk
package org.squbs.samples.pubsub.cluster
import akka.actor._
import com.twitter.zk.{ZNode, ZkClient, RetryPolicy}
import com.twitter.util._
import java.util.concurrent.TimeUnit
import scala.collection.mutable
import com.typesafe.config.ConfigFactory
import org.apache.zookeeper.CreateMode
import com.google.common.base.Charsets
@phoenix24
phoenix24 / sample-cluster-client
Last active May 19, 2022 18:12
sample akka cluster client.
package spikes.cluster
import akka.actor._
import com.typesafe.config.ConfigFactory
import akka.contrib.pattern.{ClusterClient, ClusterReceptionistExtension}
object DemoMaster {
def main(args: Array[String]): Unit = {