Skip to content

Instantly share code, notes, and snippets.

View RawToast's full-sized avatar
🐾
走りたい!

RawToast

🐾
走りたい!
View GitHub Profile
@Daenyth
Daenyth / Prelude.scala
Created January 14, 2022 14:47
cats-effect prelude
package com.myproject.prelude
import cats.syntax.{AllSyntaxBinCompat => CatsSyntax}
import cats.effect.syntax.{AllSyntax => CESyntax}
import cats.effect.instances.{AllInstances => CEInstances}
/** Custom prelude for importing with -Yimport
*
* This means we never need to import cats syntax or stream explicitly
*/
@raulraja
raulraja / dstagless.kt
Last active December 15, 2018 01:23
Tagless data source strategies with Arrow
import arrow.Kind
import arrow.core.Option
import arrow.core.left
import arrow.core.right
import arrow.effects.typeclasses.Async
import arrow.typeclasses.ApplicativeError
data class UserId(val value: String)
data class User(val userId: UserId)
data class Task(val value: String)
@Daenyth
Daenyth / MonadAndFs2Ops.md
Last active August 22, 2023 15:58
Cheat sheet for common cats monad and fs2 operation shapes
Operation Input Result Notes
map F[A] , A => B F[B] Functor
apply F[A] , F[A => B] F[B] Applicative
(fa, fb, ...).mapN (F[A], F[B], ...) , (A, B, ...) => C F[C] Applicative
(fa, fb, ...).tupled (F[A], F[B], ...) F[(A, B, ...)] Applicative
flatMap F[A] , A => F[B] F[B] Monad
traverse F[A] , A => G[B] G[F[A]] Traversable; fa.traverse(f) == fa.map(f).sequence; "foreach with effects"
sequence F[G[A]] G[F[A]] Same as fga.traverse(identity)
attempt F[A] F[Either[E, A]] Given ApplicativeError[F, E]
@thilinapiy
thilinapiy / mongo-statefulset.yaml
Created October 27, 2017 12:21
MongoDB statefulset for kubernetes with authentication and replication
## Generate a key
# openssl rand -base64 741 > mongodb-keyfile
## Create k8s secrets
# kubectl create secret generic mongo-key --from-file=mongodb-keyfile
---
apiVersion: v1
kind: Service
metadata:
name: mongo
labels:
@noelwelsh
noelwelsh / Website.scala
Created May 12, 2017 16:19
Simple website login implemented using the free monad
object Website {
import cats.free.Free
import cats.Comonad
import scala.io._
final case class User(username: String)
sealed trait Page
final case object Welcome extends Page
final case object TryAgain extends Page
@RawToast
RawToast / CoreDataHelper.swift
Created October 2, 2015 12:29
In memory CoreData configuration for unit testing
import Foundation
import CoreData
func setUpInMemoryManagedObjectContext() -> NSManagedObjectContext {
let managedObjectModel = NSManagedObjectModel.mergedModelFromBundles([NSBundle.mainBundle()])!
let persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: managedObjectModel)
do {
try persistentStoreCoordinator.addPersistentStoreWithType(NSInMemoryStoreType, configuration: nil, URL: nil, options: nil)
} catch {
@DenisIzmaylov
DenisIzmaylov / INSTALLATION.md
Last active April 27, 2023 15:44
OS X 10.11 El Capitan: fresh install with Node.js (io.js) Developer Environment

OS X 10.11 (El Capitan) / Node.js and io.js Developer Environment

Custom recipe to get OS X 10.11 El Capitan running from scratch with useful applications and Node.js Developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after fresh install.

Content

@traviskaufman
traviskaufman / logback_disable_in_unit_tests.md
Last active March 20, 2023 08:38
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>
@fasiha
fasiha / core5k-RTK-lite-kanji.md
Last active April 29, 2019 12:47
Using Nayr's Core5000 deck, based on *A Frequency Dictionary of Japanese* by Yukio Tono, Makoto Yamazaki, and Kikuo Maekawa (2013), to generate Remebering the Kanji Lite lists

Core5000, all 1503 kanji, as they appear in Core5000

事言思物何私無行時人若来見今良所自分中後方訳本当持出考入作聞聴場合話使日風前多一子供非常気取知感番二同必要仕余僕皆彼食書次結構問題例目眼頃上他家付陽間違受葉少買手好返掛終意味形三最初大住近特誰友達緒生活国現在高悪乗変会社実際先女心金顔町街及体読昔教対水置楽声普通残車度強力全呼局歩男性学校世界状態然飲新早小相母以関係四店頭電長夜別者親名部立毎族果況代覚東京続俺父確法説明屋朝得選面白戻勉下始犬嬉遊理由簡単死回内容経験木点音海応与利用働杯共存絶切足走待写真五寝英語決忘口送姿期逆頑張示々道有難山程願昭和向連影響病院年花求情報十開島重婚認歴史増外進起嫌駅映画身客質含地域我娘平成図紹介安夢規定色探興売化印象品参加夏解件敢的様答過配笑午動主困環境比引辺離火施練習越企業奴怖絵酒原因守広猫調六落打夫数割丈申可能述是料歌幾互着記憶基月君魚旅健康深伝集戦争流致厳不限愛途研究済描驚元素晴座機信古識低曲去土振評価息似悲雨詳紀昨喜便迎耳表注雰囲痛将転川隣段律妻冬具発繰泣七紙努判断両念庭払船九授亡止議茶直接効触飼民殺徴神暮飛雑誌怒整備建談絡懸命突首設指失光並八美優異婆至育種類商胸頼材勝運捨幸横伴予馬完格位展飯危険想像許文借準春寒般第押責任択負技術減焼慣推半条医秋趣徒従検討占査保正字空役球公園個消激短薬試遅資扱摘除週政府計階量田舎寂再勤吸希望急勧齢疲弱渡患壁路反提肩匂銀購右雪仲緑狭敗功協伯産卒降野菜告移血涙逃警察兄細静腰催瞬暗届窓伸森標更謝腕鹿忙遠苦労課仰為悩論録温眺極積故鳥市眠固値避穴捕洗左珍尋制登額塩奥組傾拡疑肉差章背景担豊助詰阪支抱追権算納織薄治療昼赤較荷魅村撮導韓営南季節枚輩員距泊充散黒石挨拶携帯休甘弟卵服妹交訪汗改善曜咲暑慢浮益裏姉継北宿掲都就職派舞台弾宅腹呂香菓被害椅桜躍恥皮革夕抜敵側祭沖縄幼稚処勢暇隠緊帰席歯星砂糖維太湯約束米周伺精冷適宗範裕械寄費層旦那揃誘採飾純植契叫駄髪管工婦監督鍋鼻復塗老倒翌則販諦障迷惑締餌床黙護等演奏泉室載肌症骨偉熱援握司盛犯罪批師浜脳器寺底刺吹訴把震昇複観祖抵狙迫唯青了未視波誕汚畑履膝案務孫包式虫到痩遥収掃徐促癖速製慌措油線造筋策濃館靴礼炒投玄込証沸剣巻恐牛乳否踏干箱泳邪踊攻撃弁久幅挑独壊仮輸満鍵詩西項塾県耐揮閉芝居析釈奪傷蔵庫慮港換防妊娠貸破削遣沿輝襲募属富喉布団宇宙唇釣覧拾絞江戸天敷洋承偶懐机

@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git