Skip to content

Instantly share code, notes, and snippets.

View mhoffman's full-sized avatar

Max Hoffmann mhoffman

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env scala -savecompiled
object Main extends App {
def getName(y: Any) = {
val list = y.getClass.toString.split("\\$").map(_.trim).toList
list(list.length - 1)
}
object x {
#!/usr/bin/env scala -savecompiled
import scala.io
val filename = new Exception().getStackTrace.head.getFileName
val file = scala.io.Source.fromFile(filename)
for (line <- file.getLines) {
println(line)
}
file.close
#!/usr/bin/env scala -savecompiled
for (i <- 1 to 15) {
if (i % 15 == 0 ){
println("FizzBuzz")
} else if (i % 5 == 0) {
println("Buzz")
} else if (i % 3 == 0) {
println("Fizz")
} else {
// An Import
var _ = require('lodash')
// A function
const times2 = (x) => {
return 2 * x
}
// An Object
const o = {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# always use pushd/popd by default
# and if directory turns out to be a file, we open it with vi :-)
function cd() {
if [ "$#" = "0" ]
then
pushd ${HOME} > /dev/null
elif [ -f "${1}" ]
then
${EDITOR} ${1}
else