Skip to content

Instantly share code, notes, and snippets.

@michaelpigg
michaelpigg / Dependencies.scala
Created May 18, 2016 21:07
Sharing sbt build dependencies
// project/Dependencies.scala
package foo
import sbt._
object Dependencies {
val config = "com.typesafe" % "config" % "1.3.0"
}
@michaelpigg
michaelpigg / spark_query_check.scala
Last active August 28, 2015 19:42
Check that types from a query match expected types
import org.apache.spark.sql.functions._
import org.apache.spark.sql.types._
import org.apache.spark.sql.catalyst.SimpleCatalystConf
import org.apache.spark.sql.catalyst.analysis.{Analyzer, EmptyFunctionRegistry, SimpleCatalog}
import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
import org.apache.spark.sql.catalyst.expressions.AttributeReference
val conf = new SimpleCatalystConf(false)
val catalog = new SimpleCatalog(conf)
@michaelpigg
michaelpigg / Main.scala
Created May 13, 2015 15:20
Investigate behavior of Akka scheduled tasks
import akka.actor.ActorSystem
import scala.concurrent.duration._
object Main extends App {
import scala.concurrent.ExecutionContext.Implicits.global
val sys = ActorSystem("tester")
val task1 = sys.scheduler.schedule(1 minute, 1 minute, new Runnable {
override def run() = {
@michaelpigg
michaelpigg / bbb.yml
Last active August 29, 2015 14:20 — forked from boneskull/bbb.yml
# CHANGELOG
# 3/22/15:
# - updated keyring
#
# To setup ansible on Mac:
# brew install ansible
# mkdir -p /usr/local/etc/ansible
# mkdir -p /usr/local/share/ansible
#
# To run:
@michaelpigg
michaelpigg / links.html
Last active August 29, 2015 14:20
AngularJS links
@michaelpigg
michaelpigg / controller.js
Last active August 29, 2015 14:20
ghquery files
angular.module("gh-query")
.controller("app", function($scope) {
$scope.goClick = function(user) {
$scope.$broadcast('userchange', {username: user});
}
})
.controller("reposCtrl", function($scope, reposSvc) {
$scope.$on('userchange', function(event, msgdata) {
reposSvc.getRepos(msgdata.username).success( function (data) {
$scope.repositories = data;
[error] References to undefined settings:
[error]
[error] scala/*:sourceDirectory from scala/universal:sourceDirectory (/Users/michael/.sbt/0.13/build.sbt:5)
[error] Did you mean scala/universal:sourceDirectory ?
[error]
[error] scala/*:sourceDirectory from scala/docker:sourceDirectory (/Users/michael/.sbt/0.13/build.sbt:5)
[error] Did you mean scala/universal:sourceDirectory ?
[error]
[error] scala/compile:mainClass from scala/*:batScriptReplacements (/Users/michael/.sbt/0.13/build.sbt:5)
[error]
@michaelpigg
michaelpigg / regex-weburl.js
Created November 2, 2012 15:21 — forked from dperini/regex-weburl.js
URL regular expression
//
// Regular Expression for URL validation
//
// Based on gist https://gist.github.com/729294 published by: Diego Perini
// Updated: 2012/11/02
//
// This validator differs from the Perini validator in a couple of ways:
// - It only allows http or https
// - It allows private network addresses
// - It does not allow query strings or fragments
@michaelpigg
michaelpigg / gist:3370391
Created August 16, 2012 14:13
Syntactic sugar to avoid awkward callback signature when using ActionScript Array functions
private function all(matchers: Array)
{
return function(item: Object, index: int, array: Array): Boolean
{
return matchers.every(function(testFunction: Function, funcIndex: int, funcArray: Array): Boolean {
return testFunction(item, index, array);
});
}
}