Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright 2020 Roberto Leibman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@quelgar
quelgar / typed_errors.md
Last active January 16, 2024 09:36
Every Argument for Static Typing Applies to Typed Errors

Every Argument for Static Typing Applies to Typed Errors

Think of all the arguments you've heard as to why static typing is desirable — every single one of those arguments applies equally well to using types to represent error conditions.

An odd thing I’ve observed about the Scala community is how many of its members believe that a) a language with a sophisticated static type system is very valuable; and b) that using types for error handling is basically a waste of time. If static types are useful—and if you like Scala, presumably you think they are—then using them to represent error conditions is also useful.

Here's a little secret of functional programming: errors aren't some special thing that operate under a different set of rules to everything else. Yes, there are a set of common patterns we group under the loose heading "error handling", but fundamentally we're just dealing with more values. Values that can have types associated with them. There's absolutely no reason why the benefits of static ty

@magicleon94
magicleon94 / main.dart
Last active January 21, 2024 17:08
Flutter hooks playground
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@ChristopherDavenport
ChristopherDavenport / jdg-email-expanded.md
Last active April 7, 2023 17:30
Scala Community Email Regarding John De Goes

We're aware that a private gist of a final draft posted by a committee member was publicly circulated. This was a private message to select members of the Scala community. We chose to keep our public statement brief out of courtesy to John. The text was authored by the Typelevel Steering Comittee which consists of Christopher Davenport, Alexandru Nedelcu, Ross A Baker, Daniel Spiewak, Miles Sabin, Lars Hupel, Rob Norris, Michael Pilquist, Kai Wang, and Luka Jacobowitz over the last 11 weeks.

For transparency the full text is included below:

Regarding John De Goes

We are contacting you privately to give you advance notice of disciplinary action we will be taking against John De Goes tomorrow.

Effective tomorrow morning, John De Goes will be indefinitely barred from participating in Typelevel projects, with the most relevant impact being on Cats Effect. This writing is an attempt to lay out the facts of the situation, with as much historical context as is rele

Getting Started in Scala

This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere…  I hope to present the information you need without assuming anything.

Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!

One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.

Getting the JVM

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:

@gkbrk
gkbrk / whois.rs
Created December 5, 2015 17:43
Rust whois client
use std::io::prelude::*;
use std::net::TcpStream;
use std::io::BufReader;
use std::env;
fn get_tld_server(tld: &str) -> Option<String> {
let mut stream = TcpStream::connect("whois.iana.org:43").unwrap();
stream.write_all(format!("{}\n", tld).as_bytes()).unwrap(); //Send the tld
let reader = BufReader::new(stream);
@bvssvni
bvssvni / watch.sh
Created January 2, 2015 16:32
Cross platform watch script for Rust - updated for `cargo build`
#!/bin/bash
#written by zzmp
# This script will recompile a rust project using `cargo build`
# every time something in the specified directory changes.
# Watch files in infinite loop
watch () {
UNAME=$(uname)
@axel22
axel22 / publication.scala
Last active August 29, 2015 14:11
Snippets showing several publication examples.
import scala.collection._
import scala.concurrent._
import ExecutionContext.global
object Ex1 {
var x: List[Int] = null
def foo() {
val buffer = mutable.ListBuffer[Int]()
buffer ++= (0 until 100)
@acolyer
acolyer / service-checklist.md
Last active July 10, 2024 05:13
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?