Skip to content

Instantly share code, notes, and snippets.

@ppurang
ppurang / README.md
Last active February 18, 2024 04:11 — forked from keynmol/README.md
Scala example of using htmx
@ppurang
ppurang / build.sbt
Created October 4, 2019 12:32 — forked from channingwalton/build.sbt
Scala 2.13 compiler flags
val scalacOptions ++= Seq(
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
@ppurang
ppurang / installation.md
Created March 25, 2019 08:48 — forked from natbusa/installation.md
Dell XPS for Ubuntu 18.04

Dell XPS for Ubuntu 18.04

Bios:

press F12 on the Dell startup screen

  • disable safe boot
  • Change SATA Operation from "RAID On" to "AHCI"
  • Enable Legacy Boot as well as UEFI

Install Ubuntu from USB drive

Instructions are here: https://www.ubuntu.com/download/desktop

@ppurang
ppurang / LandingFestival Berlin 2018 CFP.md
Last active January 24, 2018 20:41
Pitch for LandingFestival Berlin 2018

#CallForSpeakers pitch for #LandingFestival Berlin 2018

Considered leveraging your technical debt?

Description

How often do you hear the term MVP (minimum viable product) bandied around in startup land? It’s often a necessary evil. Technical debt, or the implied cost of the additional work caused by choosing an easy option now, rather than opting for a better solution which may take more time, is commonplace in almost every engineering team and its products. As engineers, we need to aggressively manage our technical debt, but also open our eyes to the opportunity it can provide. It’s akin to financial leverage, and has future value.

Key takeaway

I'll debunk the myths around technical debt, share how to aggressively manage it, and how to leverage it for the good of the product, the team, the company and the end user.

import akka.actor.Actor.Receive
import akka.actor.ActorContext
import akka.actor.ActorLogging
import akka.actor.Actor
import akka.event.LoggingAdapter
object MyLoggingReceive {
def apply(log: LoggingAdapter)(r: Receive)(implicit context: ActorContext): Receive = r match {
case _: MyLoggingReceive ⇒ r
@ppurang
ppurang / gist:6864736
Created October 7, 2013 08:57
getFileExtension from You Can't JavaScript Under Pressure
//caution this is a very bad idea for a function even in javascript!
function getFileExtension(i) {
// i will be a string, but it may not have a file extension.
// return the file extension (with no period) if it has one, otherwise false
var x;
if(i.lastIndexOf(".") > -1)
x = i.substring(i.lastIndexOf(".")+1, i.length);
// Run this with scala <filename>
/**
* A Two-phase commit Monad
*/
trait Transaction[+T] {
def map[U](fn: T => U): Transaction[U] = flatMap { t => Constant(fn(t)) }
def flatMap[U](fn: T => Transaction[U]): Transaction[U] =
FlatMapped(this, fn)
@ppurang
ppurang / livescript.html
Created August 14, 2013 07:43
Livescript on the client - an html file and a test script
<!DOCTYPE html>
<html lang="en">
<head>
<title>livescript</title>
</head>
<body>
<h1>
Livescript - check the browser's console
</h1>
<h2>
@ppurang
ppurang / gist:5768047
Last active December 18, 2015 10:19
spray coffee payment web-service somewhat more complicated example
//from https://github.com/ppurang/spray-example
//below retreive(id) always returns Option[Order]
trait CoffeePaymentService extends HttpService with LiftJsonSupport {
self: PersistenceCoffee =>
override implicit def liftJsonFormats: Formats = Order.format
val paymentRoute =
pathPrefix("payment"/"order") {