Skip to content

Instantly share code, notes, and snippets.

View jiyeonseo's full-sized avatar
🧀
Say cheese 🧀

Cheese jiyeonseo

🧀
Say cheese 🧀
View GitHub Profile
@ikhoon
ikhoon / Contravariant.scala
Last active June 10, 2022 05:59
왜 함수의 input은 반공변성인가?
// https://twitter.github.io/scala_school/type-basics.html
// 트위터 스칼라 스쿨에 나오는 자료구조를 활용해보겠다.
class Animal { val sound = "rustle" }
class Bird extends Animal { override val sound = "call" }
class Chicken extends Bird { override val sound = "cluck" }
class Duck extends Bird { override val sound = "duck" }
def foo(tweet: Bird => String) = {
tweet(new Bird)
object TwiiterScalaFutureOps {
import TwitterScalaFutureConverters._
implicit class ScalaToTwitterFuture[T](f: Future[T]) {
def toTwitterFuture: twitter.Future[T] = scalaToTwitterFuture(f)
}
implicit class TwitterToScalaFuture[T](f: twitter.Future[T]) {
def toScalaFuture: Future[T] = twitterToScalaFuture(f)
}
@ravibhure
ravibhure / git_rebase.md
Last active April 3, 2024 08:38
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@ikhoon
ikhoon / must-watch-talks.md
Last active April 14, 2020 10:46
Must watch talks - reddit /r/scala
@ikhoon
ikhoon / Java8TimeTest.java
Created August 31, 2016 06:25
Java8 Time API 기능 비교
import org.junit.Test;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException;
public class Java8TimeTest {
private String instantFormat = "2007-12-03T10:14:30.000Z";
@debasishg
debasishg / gist:1261857
Created October 4, 2011 14:58
a brief rant about |@| in scalaz
/**
* |@| is a helper function that helps you accumulate applicative functors. It gives you an ApplicativeBuilder (it's part of
* the implementation though) through which you accumulate your applicatives just as you would using the Builder pattern of
* the GoF in the OO world. Once you have all the applicatives you can pass it a function that will be applied to all the
* values that you have accumulated so far. e.g.
*/
scala> (1.some |@| 2.some) apply {_ + _}
res1: Option[Int] = Some(3)