I hereby claim:
- I am bmc on github.
- I am bmc (https://keybase.io/bmc) on keybase.
- I have a public key whose fingerprint is B57B 6B4B 451A F540 4D21 BEA4 1588 40B4 A8A7 FD98
To claim this, I am signing this object:
# A stack, using bash arrays. | |
# --------------------------------------------------------------------------- | |
# Create a new stack. | |
# | |
# Usage: stack_new name | |
# | |
# Example: stack_new x | |
function stack_new | |
{ |
module RFC1918 | |
def is_rfc1918_address(ip) | |
unless ip =~ /^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})$/ | |
raise "#{ip} is not an IP address" | |
end | |
octets = [$1, $2, $3, $4].map &:to_i | |
raise "#{ip} is a bad IP address" unless octets.all? {|o| o < 256} | |
# The Internet Assigned Numbers Authority (IANA) has reserved the |
object StaticFile { | |
// Various necessary imports. Notes: | |
// | |
// 1. fs2 is necessary. See https://github.com/functional-streams-for-scala/fs2 | |
// 2. streamz is necessary. See https://github.com/krasserm/streamz | |
// 3. Apache Tika is used to infer MIME types from file names, because it's more reliable and | |
// fully-featured than using java.nio.file.Files.probeContentType(). | |
// | |
// If using SBT, you'll want these library dependencies and resolvers: |
case class Article(...); | |
object Article { | |
import DBUtil._ | |
def delete(id: Long): Either[String, Boolean] = { | |
withTransaction { implicit connection => | |
SQL("DELETE FROM comments WHERE article_id = {id}").on("id" -> id).executeUpdate() | |
SQL("DELETE FROM appusers WHERE id = {id}").on("id" -> id).executeUpdate( ) | |
Right(true) |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import java.util.Date | |
import java.text.SimpleDateFormat | |
import fs2._ | |
// id and gender should really be more strongly-typed, but | |
// this is just a demo... | |
case class Person(id: Int, | |
firstName: String, |
import org.apache.spark.sql.types._ | |
import org.apache.spark.sql._ | |
object Implicits { | |
def schemaAsCode(schema: StructType, indentation: Int = 2): String = { | |
def prettyStruct(st: StructType, indentationLevel: Int): String = { | |
val indentSpaces = " " * (indentationLevel * indentation) | |
val prefix = s"${indentSpaces}StructType(List(\n" | |
val fieldIndentSpaces = " " * ((indentationLevel + 1) * indentation) | |
val fieldStrings: Seq[String] = for (field <- st.fields) yield { |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
# | |
# Fix an EPUB document generated by Pandoc to have a title page. | |
# | |
# Usage: fixepub epub_in epub_out cover_png | |
# | |
# Only supports PNG at the moment, but easily hacked to support JPEG. | |
# | |
# Requires these gems: | |
# |
package org.clapper | |
import scala.language.implicitConversions | |
import contextual._ | |
object ThingTest1 { | |
case class Thing(s: String) |