This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.arrow.NaturalTransformation | |
import cats.std.option._ | |
import cats.syntax.cartesian._ | |
implicit val opt2opt = NaturalTransformation.id[Option] | |
implicit def id2F[F[_]: Applicative] = new (Id ~> F) { | |
def apply[A](a: Id[A]): F[A] = Applicative[F].pure(a) | |
} | |
def foo[A: Order, F[_]: ~>[?[_], H], G[_]: ~>[?[_], H], H[_]: Applicative](f: F[A], g: G[A]) = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fail.sauce.example123 | |
import cats.Monad | |
import shapeless.{HList, HNil, ::} | |
import shapeless.Poly2 | |
import shapeless.UnaryTCConstraint | |
import shapeless.UnaryTCConstraint.*->* | |
import shapeless.ops.hlist.RightFolder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object DocCommentFinder { | |
def findByName[G <: Global](g: G)(rootTree: g.Tree, searchNames: Set[String]): Map[g.Symbol, g.DocComment] = { | |
import g.{ Try ⇒ _, _ } | |
val searchSymbols: Set[Symbol] = searchNames.map(name ⇒ g.rootMirror.staticModule(name)) | |
findBySymbol(g)(rootTree, searchSymbols) | |
} | |
def findBySymbol[G <: Global](g: G)(rootTree: g.Tree, searchSymbols: Set[g.Symbol]): Map[g.Symbol, g.DocComment] = { | |
import g._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type F[U <: Universe] = (ToolBox[U], MyUtility[U]) ⇒ Unit | |
def example(f: F[_]) = { | |
val toolbox = scala.reflect.runtime.currentMirror.mkToolBox() | |
val util = MyUtility[toolbox.u.type](toolbox.u) | |
f(toolbox, util) | |
} | |
// usage, doesn't compile | |
example { (tb, util) ⇒ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val cl = // a valid ClassLoader | |
val classNames: List[String] = | |
classOf[String].getName :: "$$$$" :: List.getClass.getName :: Nil | |
type Acc = (List[Throwable], List[Class[_]]) | |
val res = classNames.foldLeft((Nil, Nil): Acc) { (acc, className) ⇒ | |
Try(Class.forName(className, true, cl)) match { | |
case Success(c) ⇒ (acc._1, c :: acc._2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# find path to most recently updated simulator log | |
LOG_PATH=`find ~/Library/Logs/CoreSimulator/*/system.log -type f -print0 | xargs -0 stat -f "%m %N" | | |
sort -rn | head -1 | cut -f2- -d" "` | |
green=`tput setaf 2` | |
reset=`tput sgr0` | |
# formatter | |
FORMAT () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
# usage: zoom <room-number> [room-password] [--name=NAME] | |
on split(theString, theDelimiter) | |
set oldDelimiters to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to theDelimiter | |
set theArray to every text item of theString | |
set AppleScript's text item delimiters to oldDelimiters | |
return theArray |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ParseFacebookUtils", | |
"version": "1.3.0", | |
"license": { | |
"type": "Commercial", | |
"text": "See https://www.parse.com/about/terms" | |
}, | |
"homepage": "https://www.parse.com/", | |
"summary": "Parse is a complete technology stack to power your app's backend.", | |
"authors": "Parse", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_deploy: | |
- mkdir deploy_staging | |
- cp */target/**/*.jar deploy_staging | |
deploy: | |
skip_cleanup: true | |
provider: s3 | |
bucket: build-bucket | |
region: us-west-2 | |
local-dir: deploy_staging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Magnetic[T] { | |
protected sealed trait TagMag | |
type Magnet = T @@ TagMag | |
protected implicit def tag(value: T) = Tag[T, TagMag](value) | |
def apply(mag: Magnet): T = mag | |
} | |
object CreateDescriptor extends Magnetic[CreateDescriptor] { | |
implicit def default(unit: Unit): Magnet = CreateDescriptor(None, AssetDescriptorRecord()) | |
implicit def fromUser(user: ProfilePair): Magnet = CreateDescriptor(Some(user), AssetDescriptorRecord()) |