Demonstrate how to get things to magically happen when you import instances of a class.
This file contains 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
let | |
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz); | |
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; }; | |
in | |
with nixpkgs; | |
stdenv.mkDerivation { | |
name = "veloren-env"; | |
buildInputs = [ | |
(nixpkgs.rustChannelOf { date = "2019-04-11"; channel = "nightly"; }).rust | |
git |
This file contains 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 a8.scalajs.ui | |
import cats.implicits._ | |
import mhtml._ | |
import mhtml.implicits.cats._ | |
import a8.common.Labeler | |
import a8.manna.model.ElementId | |
import a8.scalajs.Events | |
import org.scalajs.dom | |
import org.scalajs.dom.KeyboardEvent |
This file contains 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 scala.util.Try | |
object PathSerializer { | |
trait SerDe[A] { | |
// By using a path dependent type, we can be sure can deserialize without wrapping in Try | |
type Serialized | |
def ser(a: A): Serialized | |
def deser(s: Serialized): A | |
// If we convert to a generic type, in this case String, we forget if we can really deserialize |
This file contains 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
#!/bin/sh | |
# Put in your Rust repository's .git/hooks/pre-commit to ensure you never | |
# breaks rustfmt. | |
# | |
# WARNING: rustfmt is a fast moving target so ensure you have the version that | |
# all contributors have. | |
for FILE in `git diff --cached --name-only`; do | |
#if [[ $FILE == *.rs ]] && ! rustup run nightly rustfmt --write-mode diff --skip-children $FILE; then |
This file contains 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
# Use this environment to publish this package on pypi: | |
# | |
# # Enter the environment | |
# nix-shell release.nix | |
# | |
# # create the package | |
# python setup.py bdist | |
# | |
# # register to pypi (if not registered yet) | |
# twine register dist/project_name-x.y.z.tar.gz |
This file contains 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
#!/bin/sh | |
echo -e "-- Removing exited containers --\n" | |
docker ps --all --quiet --filter="status=exited" | xargs --no-run-if-empty docker rm --volumes | |
echo -e "\n\n-- Removing untagged images --\n" | |
docker rmi --force $(docker images | awk '/^<none>/ { print $3 }') | |
echo -e "\n\n-- Removing volume directories --\n" | |
docker volume rm $(docker volume ls --quiet --filter="dangling=true") |
$ uname -r
Want to use Nix for development but you're not sure how? Concerned about the
fluidity of nixpkgs
channels or not being able to easily install arbitrary
package versions?
When I first heard about Nix it seemed like the perfect tool for a developer. When I tried to actually use it for developing and deploying web apps, though, the pieces just didn't seem to add up.
NewerOlder