Skip to content

Instantly share code, notes, and snippets.

View imeredith's full-sized avatar

Ivan Meredith imeredith

View GitHub Profile
@imeredith
imeredith / tips.md
Last active January 25, 2019 02:21
Tips for development in WSL

Dev tools

  • Other than editors, install everything needed in WSL. It's easier.
  • Piping to windows programs does work, just remember to add .exe
    • echo 1234 | clip.exe
  • Editors can't see anything in Linux FS, keep all code in /mnt/c

Symlinks

  • Enable windows developer mode

Publishing pre-release versions of an NPM package

There are times when we want to be able to publish pre-release (ala SNAPSHOT in maven terminology) versions of NPM packages to the NPM registry. We want to do this so as to provide these pre-release versions to CI builds of other dependant components etc. But what we do NOT want is for these pre-release packages to be unknowingly installed by someone that simply runs npm install <packagename> (i.e. does not specify an @<version> suffix).

Key Concepts

Here are the key things you need to understand in order to be able to publish pre-release versons of packages:

  1. By default, the npm publish command publishes the package and gives a tag of latest to the version in the package.json, overwriting the lasts latest tag version.
  2. By default, the npm install command installs the package version that has the latest tag.
package play
import _root_.scalaz._
import _root_.scalaz.Scalaz._
import play.api.libs.concurrent.Promise
package object scalaz {
implicit val PromiseInstance = new Monad[Promise] {
// override def map[A,B](fa: Promise[A])(f: A => B) = fa.map(f)
@nafg
nafg / gist:3031581
Created July 2, 2012 07:03
Extensible data processors
/*
THE OBJECTIVE:
Given some Q[A] (Q might be ScalaQuery's query, A might be the first column of the table),
there should be a function that can return an object that has a Q[B] (B might be the first two columns
of the table), and a way to go from a B to an A (e.g. from (Int, String) to Int). We need to have a
collection of such objects (not sure if List or HList).
The purpose is this:
Suppose for instance I want to develop a very pluggable issue tracker. Its core implementation might
@xeno-by
xeno-by / gist:2559714
Created April 30, 2012 16:19
Mixing in a trait dynamically
Answers http://stackoverflow.com/questions/10373318/mixing-in-a-trait-dynamically.
Compile as follows:
scalac Common_1.scala Macros_2.scala
scalac Common_1.scala Test_3.scala -cp <path to the result of the previous compilation>
Tested in 2.10.0-M3, will most likely not compile by the time 2.10.0 final is released, because we're actively rehashing the API.
However the principles will remain the same in the final release, so the concept itself is okay.
upd. Code updated for 2.10.0-M7.
upd. Code updated for 2.10.0-RC1.
@oxbowlakes
oxbowlakes / 3nightclubs.scala
Created May 13, 2011 15:14
A Tale of 3 Nightclubs
/**
* Part Zero : 10:15 Saturday Night
*
* (In which we will see how to let the type system help you handle failure)...
*
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0)
*/
import scalaz._
import Scalaz._