Skip to content

Instantly share code, notes, and snippets.

View jackcviers's full-sized avatar

Jack Viers jackcviers

View GitHub Profile
@jackcviers
jackcviers / Not a nightmare.md
Created March 22, 2021 21:36
Scala isn't a maintenance nightmare

So the hacker news post said my comment was too long. Warning, long, opinionated post:

Scala dev for 10+ years here. Spark is weird. Databricks has a style guide that deliberately chooses not to use scala features that the rest of the community uses, and doesn't follow the same best practices around library and scala major version usage that the rest of the community uses [1]. It's no surprise that the project has trouble interoperating with libraries outside of the spark ecosystem, and is therefore a maintenance problem.

Spark's style and compatibility problems

Scala isn't a maintenance nightmare, but it does attract a lot of newcomers who dive in, don't stick within one of its many ecosystems, get confused, and generally leave a mess, and that is a direct result of the fact that scala is a multi-paradigm, relatively expressive language to the one(s) it is competing with and pulling developers from, and that those developers, for the large part, don't really want to change and think that Scala is just a

@jackcviers
jackcviers / MonadErrorExample.scala
Created March 27, 2017 21:59
MonadError example
import cats.MonadError
import cats.instances.either._
import cats.instances.future._
import cats.instances.try_._
import cats.syntax.applicativeError._
import cats.syntax.flatMap._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
@jackcviers
jackcviers / gist:9944686
Last active August 29, 2015 13:58 — forked from pbrit/gist:9713531
patch ruby for gem compile on osx mavericks
82c82
< CONFIG["LIBRUBY_DLDFLAGS"] = "-undefineddynamic_lookup -multiply_definedsuppress -install_name $(libdir)/$(LIBRUBY_SO) -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(ruby_version) $(XLDFLAGS)"
---
> CONFIG["LIBRUBY_DLDFLAGS"] = "-undefineddynamic_lookup -multiply_defined suppress -install_name $(libdir)/$(LIBRUBY_SO) -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(ruby_version) $(XLDFLAGS)"
125c125
< CONFIG["DLDFLAGS"] = "-undefineddynamic_lookup -multiply_definedsuppress"
---
> CONFIG["DLDFLAGS"] = "-undefineddynamic_lookup -multiply_defined suppress"
@jackcviers
jackcviers / Article.txt
Last active December 21, 2015 15:29
Make Promises. Even the ones you can't keep.
In "Make No Promises" David Nolen asserts that promises don't eliminate callback hell[1]. This is not true. Take a situation where a program makes several asynchronous calls and aggregates the results in some processing step. Each call may fail. If any one of the calls fails the program cannot continue processing and must report the error.
It would be possible to write the program in a traditional callback style, and make the code easy to understand and follow. I can think of two ways to do this.
The first is to make each call and define a success handler that added the results to a shared array, and an error handler that reported each error. Then pass the success and error handler to each call. This leads to a possible outcome where the resulting aggregation may be partially complete. The program must keep track of how many of the requests have completed. The program must check the length of the results on each completion and error to see if processing can continue. I dislike this approach, because the re
$("document").openPopup
url: 'test'
doOnContentLoad: -> console.log 'doOnContentLoad'
new_row.append $('<td>').text(media.name),
$('<td>').text media.creator
$('<td>').text media.media_type
@jackcviers
jackcviers / kill-line-yank-newline.el
Last active December 17, 2015 10:38
kill-line-yank-newline copies the current line and inserts a duplicate of that line after the current line, with the parts of the import expression after the cursor deleted.. Useful for adding additional imports of the same package in languages such as java and scala.
;; Copyright (C) 2013 Jack Viers
;; Author: Jack Viers <jackcviers@gmail.com>
;; This file is not part of GNU Emacs.
(defun kill-line-yank-newline ()
(interactive)
(let ((beg (line-beginning-position)) (end (line-end-position)) (name (buffer-name)) (col (current-column)))
(end-of-line)
(newline)
@jackcviers
jackcviers / ac-modes-example
Created May 9, 2013 03:58
ac-modes-example
(add-to-list 'ac-modes 'coffee-mode)
(add-to-list 'ac-modes 'js-mode)
(add-to-list 'ac-modes 'handlebars-mode)
// Wrap the whole thing in domready and an anonymous function.
// This prevents anything inside of it from being clobbered
// in the global namespace and from clobbering anything
// in the global namespace.
// This is instead of defining the function globally and passing
// it to domready, like you did before:'
// $(function(){showLocation()});
$(function(){
// Take advantage of the fact that variables declared outside
// of a function are available inside any function declared
@jackcviers
jackcviers / jquery_transport_selection.js
Created February 12, 2013 17:24
jQuery, like many other "ajax" frameworks, presents a common interface for asynchronous requests, and delegates to the underlying "real" request mechanism under the hood. In this way, all types of requests use the same semantics, while the jQuery authors are allowed to switch implementations under the hood. The convention is to select the transp…
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {