Skip to content

Instantly share code, notes, and snippets.

View ikhoon's full-sized avatar
🐱
Working from home

Ikhun Um ikhoon

🐱
Working from home
View GitHub Profile
@trustin
trustin / git-checkout-pr.sh
Last active May 16, 2023 02:08
git-checkout-pr.sh - fetches a Git pull request from the remote and creates a local branch for it
#!/usr/bin/env bash
set -Eeuo pipefail
log() {
echo -en '\033[1;32m'
echo -n "$@"
echo -e '\033[0m'
}
choice() {
@mishriky
mishriky / ResilientClientSamples.scala
Created February 7, 2017 18:26
Samples for Finagle Client Configuration
/**
* This is not meant to cover ALL possible ways of creating service clients; instead it focuses on the simplest way to
* do so, while maintaining the capability to customize the clients based on service level agreements/expectations
*
* @note Most of the filters can be applied to the HTTP client as well but have been omitted from the sample code to improve
* readability
*/
trait ClientSamples extends LazyLogging {
private[this] lazy val config = ConfigFactory.load()
@paulp
paulp / global.sbt
Last active October 16, 2018 19:09
continuous compilation of the sbt build
// These lines go in ~/.sbt/0.13/global.sbt
watchSources ++= (
(baseDirectory.value * "*.sbt").get
++ (baseDirectory.value / "project" * "*.scala").get
++ (baseDirectory.value / "project" * "*.sbt").get
)
addCommandAlias("rtu", "; reload ; test:update")
addCommandAlias("rtc", "; reload ; test:compile")
addCommandAlias("ru", "; reload ; update")
@jkpl
jkpl / article.org
Last active November 9, 2022 18:46
Enforcing invariants in Scala datatypes

Enforcing invariants in Scala datatypes

Scala provides many tools to help us build programs with less runtime errors. Instead of relying on nulls, the recommended practice is to use the Option type. Instead of throwing exceptions, Try and Either types are used for representing potential error scenarios. What’s common with these features is that they’re used for capturing runtime features in the type system, thus lifting the runtime scenario handling to the compilation phase: your program doesn’t compile until you’ve explicitly handled nulls, exceptions, and other runtime features in your code.

In his “Strategic Scala Style” blog post series,

@dhavaln
dhavaln / Setup & Install
Last active October 10, 2023 13:49
Setting up HAProxy on Mac OSX
Install HAProxy from Homebre:
`brew install haproxy`
For full reference:
https://serversforhackers.com/load-balancing-with-haproxy
anonymous
anonymous / response.md
Created October 6, 2016 14:29
Response to recent InfoQ article

Most of what's written in this article is deliberately biased and wrong. It is yet another in the stream of Scala-hating posts that people. I analyze the article below:

  1. TIOBE index is a metric based on search engine ranking policies and can be intentionally or unintentionally gamed.

    https://blog.timbunce.org/2009/05/17/tiobe-index-is-being-gamed/

On these rankings, Scala is quite high:

@pchiusano
pchiusano / fs2-0.9-release-announcement.markdown
Last active September 20, 2016 12:46
FS2: Functional Streams for Scala 0.9 Official Release Announcement

Hi all!

After a very lengthy period of development and testing, FS2 (formerly scalaz-stream) version 0.9 is finally out! Here's how to get it.

For this release, the library has undergone a major redesign. Check out the migration guide for more info, and also the shiny new user guide. Going forward, we expect the API of the library will be quite stable and hope it becomes one of the bedrock libraries of the Scala ecosystem. The 0.9 series has already seen production use as well as a huge amount of testing during the development process; we feel very good about recommending people upgrade.

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@eamelink
eamelink / recursion-and-trampolines-in-scala.md
Last active April 10, 2024 15:57
Recursion and Trampolines in Scala

Recursion and Trampolines in Scala

Recursion is beautiful. As an example, let's consider this perfectly acceptable example of defining the functions even and odd in Scala, whose semantics you can guess:

def even(i: Int): Boolean = i match {
  case 0 => true
  case _ => odd(i - 1)
}

def odd(i: Int): Boolean = i match {

@wisdomfusion
wisdomfusion / install-gcc-4.9.3-on-centos6.txt
Last active March 29, 2021 03:18
Install gcc-4.9.3 on CentOS 6
yum install libmpc-devel mpfr-devel gmp-devel
cd /usr/src/
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.3/gcc-4.9.3.tar.bz2 -O
tar xvfj gcc-4.9.3.tar.bz2
cd gcc-4.9.3
./configure --disable-multilib --enable-languages=c,c++
make -j `grep processor /proc/cpuinfo | wc -l`
make install