Skip to content

Instantly share code, notes, and snippets.

Diego Alvarez d1egoaz

  • Shopify
  • Vancouver - Canada
Block or report user

Report or block d1egoaz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@d1egoaz
d1egoaz / boxstarter.ps1
Last active Oct 14, 2017 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
View boxstarter.ps1
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
View learning_scala.org
@d1egoaz
d1egoaz / AutomateScalafmtPlugin.scala
Created Mar 13, 2017
AutomateScalafmtPlugin using local ScalafmtBootstrap
View AutomateScalafmtPlugin.scala
import org.scalafmt.sbt.ScalafmtPlugin
import sbt._
import sbt.Keys._
import sbt.inc.Analysis
object AutomateScalafmtPlugin extends AutoPlugin {
object autoImport {
def automateScalafmtFor(configurations: Configuration*): Seq[Setting[_]] =
configurations.flatMap { c =>
View ScalafmtBootstrap.scala
import java.io.OutputStreamWriter
import java.io.{ByteArrayInputStream, ByteArrayOutputStream, File, PrintStream}
import java.net.URLClassLoader
import coursier._
import org.scalafmt.Versions
import scala.collection.immutable.Nil
import scala.collection.mutable
import scala.language.reflectiveCalls
@d1egoaz
d1egoaz / pre-push-install.md
Last active Dec 10, 2015
git hook pre-push installation instructions
View pre-push-install.md
@d1egoaz
d1egoaz / pre-push
Created Dec 10, 2015
Scala pre-push git hook that compiles project before pushing it to git server
View pre-push
#!/bin/sh
echo ">> Executing sbt compile before pushing to Git server"
sbt compile
compiles=$?
echo ">> Compiles?"
if [ $compiles -eq 0 ]
then
echo owly
@d1egoaz
d1egoaz / nodeMock.js
Last active Aug 29, 2015
simple node express example
View nodeMock.js
var express = require('express');
var request = require('request');
var app = express();
app.all('*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
View FileEncodingTest
package scoverage
import java.nio.charset.{MalformedInputException, CodingErrorAction}
import org.scalatest.FunSuite
import scala.io.{Source, Codec}
class FileEncodingTest extends FunSuite {
View sequencev2
def sequence[A](a: List[Option[A]]): Option[List[A]] = {
def innerAux[A](b: List[Option[A]], tmp: List[A]): Option[List[A]] = {
b match {
case Nil => Some(tmp)
case None :: _ => None
case Some(h) :: t => innerAux(t, tmp :+ h)
}
}
View sequence
def sequence[A](a: List[Option[A]]): Option[List[A]] = {
def innerAux[A](b: List[Option[A]], tmp: List[A]): Option[List[A]] = {
b match {
case Nil => Some(tmp)
case h :: t =>
h match {
case Some(v) => innerAux(t, v :: tmp)
case None => None
}
You can’t perform that action at this time.