Skip to content

Instantly share code, notes, and snippets.

View Leonti's full-sized avatar

Leonti Bielski Leonti

View GitHub Profile
# MIT License
# Copyright (c) 2016 Chandler Abraham
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
haskell-lsp:Starting up server ...
2018-05-09 12:06:07.689664 [ThreadId 4] - ---> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":36474,"rootPath":"/Users/leonti.bielski/myob/property-testing-demo/payslip-property-testing-haskell/","rootUri":"file:///Users/leonti.bielski/myob/property-testing-demo/payslip-property-testing-haskell/","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true},"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":false},"symbol":{"dynamicRegistration":false},"executeCommand":{"dynamicRegistration":false}},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"commitCharactersSupport":false},"contextSupport":true},"hover":{"dynamicRegistration":false},"signatureHelp":{"dynamicRegistration":false},"references":{"dynamicRegistration":false},"d
#![allow(unused)]
use std::io::Write;
use std::io;
use std::net::{TcpListener, TcpStream};
use std::thread;
use std::time;
use std::sync::{Arc,RwLock};
// https://github.com/Nervengift/chat-server-example/blob/master/src/main.rs
@Leonti
Leonti / main.rs
Created October 19, 2018 02:38
Use of moved value
#![allow(unused)]
#[macro_use]
extern crate crossbeam_channel;
use crossbeam_channel as channel;
use std::io::Write;
use std::io;
use std::net::{TcpListener, TcpStream};
use std::thread;
#![allow(unused)]
#[macro_use]
extern crate crossbeam_channel;
use crossbeam_channel as channel;
use std::io::Write;
use std::io;
use std::net::{TcpListener, TcpStream};
use std::thread;
use std::time;
//! A chat server that broadcasts a message to all connections.
//!
//! This example is explicitly more verbose than it has to be. This is to
//! illustrate more concepts.
//!
//! A chat server for telnet clients. After a telnet client connects, the first
//! line should contain the client's name. After that, all lines sent by a
//! client are broadcasted to all other connected clients.
//!
//! Because the client is telnet, lines are delimited by "\r\n".
@Leonti
Leonti / main.rs
Created October 29, 2018 12:24
Can't move out of borrowed context
//! A chat server that broadcasts a message to all connections.
//!
//! This example is explicitly more verbose than it has to be. This is to
//! illustrate more concepts.
//!
//! A chat server for telnet clients. After a telnet client connects, the first
//! line should contain the client's name. After that, all lines sent by a
//! client are broadcasted to all other connected clients.
//!
//! Because the client is telnet, lines are delimited by "\r\n".
@Leonti
Leonti / Fs2Zip.scala
Last active February 9, 2019 01:05
Attempt to write Stream[F, (String, Stream[F, Byte])] to zipped Stream[F, Byte]
package backup
import java.io.OutputStream
import cats.effect._
import cats.effect.implicits._
import cats.implicits._
import fs2.{Chunk, Pipe, Stream, io}
import java.util.zip.{ZipEntry, ZipOutputStream}
import fs2.concurrent.Queue
@Leonti
Leonti / CaseClassPrinting.scala
Created April 1, 2019 08:01
Print case classes from a nested structure
object Printing extends App {
trait Test {
val name: String
}
case class TestSingle(name: String, t: String, isOptional: Boolean) extends Test
case class NestedTest(name: String, fields: List[Test], isOptional: Boolean) extends Test
val testData = NestedTest("main", List(