Skip to content

Instantly share code, notes, and snippets.

View mads-hartmann's full-sized avatar

Mads Hartmann mads-hartmann

View GitHub Profile
(add-hook 'eshell-mode-hook
(lambda ()
(define-key eshell-mode-map (kbd "C-c") 'eshell-kill-process)))
@mads-hartmann
mads-hartmann / keybase.md
Created July 16, 2015 16:53
Verifying my Github account on keybase

Keybase proof

I hereby claim:

  • I am mads379 on github.
  • I am mads_hartmann (https://keybase.io/mads_hartmann) on keybase.
  • I have a public key whose fingerprint is BF71 A0F9 6C4C B0DF F30D 73D5 99E6 8045 0B61 2B11

To claim this, I am signing this object:

@mads-hartmann
mads-hartmann / Path intergral
Created March 31, 2010 17:56
Coding is a social activity - This was coded by me and a friend some lazy afternoon while drinking beer. This is a script which calculates the path integral for a function (does so horrible wrong now though).
import java.math._
def calculatePoints(xvals: List[Double], func: Double=> (Double,Double) ) = xvals.map{ x => func(x)}
def calculateLengthOfPoints(points: List[(Double,Double)], length: Double): Double = {
def distance(p1: (Double,Double), p2: (Double,Double)) =
Math.sqrt(Math.pow(p2._1-p1._1,2)+Math.pow(p2._2-p1._2,2))
points match {
case Nil => length
case point::rest if rest == Nil => calculateLengthOfPoints(rest, length)
package code.comet
import scala.xml.{NodeSeq, Text}
import net.liftweb._
import http._
import actor._
import http.js._
import JsCmds._
import JE._
import java.util.Date
@mads-hartmann
mads-hartmann / TemplateDSL.scala
Created July 27, 2010 11:37
My attempt at creating a DSL for one of my projects. Something gone wrong though.
/*==============================================================================================
| All the classes in this file are used to built the Tempalte DSL. That means
| stuff like:
|
| injectContentsOfFile "path/to/file" into "myfile.txt" atPoint "MyPoint"
|
| HOWEVER currently I have to write it like this:
|
| injectContentsOfFile("src/test/resources/user_inject_Model_Point.txt").into("src/test/resources/model.txt").at("Point")
|
package com.sidewayscoding
import sbt._
import org.lifty.engine._
// the processor
class Processor extends SBTTemplateProcessor {
def templates = MyTemplate :: Nil
}
import sbt._
class SampleSBTProcessor(info: ProjectInfo) extends ProcessorProject(info) {
val scalatools_snapshots = ScalaToolsSnapshots
val lifty_engine = "org.lifty" %% "lifty-engine" % "0.6.1"
}
<%@ var name:String %>
Hello ${name}
<%@ var name:String %>
Hello ${name}
//#inject point: farewell
<%@ var word:String %>
So Long, and Thanks for All the ${word}