Skip to content

Instantly share code, notes, and snippets.

View eltimn's full-sized avatar
🌏

Tim Nelson eltimn

🌏
View GitHub Profile
@eltimn
eltimn / chi.go
Last active February 23, 2024 22:57 — forked from alexaandru/chi.go
Chi-like syntactic sugar layer on top of stdlib http.ServeMux
// Chi-like syntactic sugar layer on top of stdlib http.ServeMux.
package main
import (
"net/http"
"slices"
)
type (
middleware func(http.Handler) http.Handler
Running from: /usr/share/jenkins/jenkins.war
May 18, 2016 3:19:36 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Logging initialized @458ms
May 18, 2016 3:19:36 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
May 18, 2016 3:19:36 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Empty contextPath
May 18, 2016 3:19:36 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-9.2.z-SNAPSHOT
May 18, 2016 3:19:37 PM org.eclipse.jetty.util.log.JavaUtilLog info
@eltimn
eltimn / JettyLauncher.scala
Last active August 29, 2015 14:24
Embedded Jetty example
package code
import java.net.{InetAddress, InetSocketAddress}
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.webapp.WebAppContext
import org.slf4j.LoggerFactory
import net.liftweb.util.Props
@eltimn
eltimn / keybase.md
Created June 3, 2015 11:12
Keybase Proof

Keybase proof

I hereby claim:

  • I am eltimn on github.
  • I am eltimn (https://keybase.io/eltimn) on keybase.
  • I have a public key whose fingerprint is 90A7 48F6 12C4 66DD 4AFC B8B3 AF3B 2EC1 8410 97E9

To claim this, I am signing this object:

@eltimn
eltimn / gist:c5a5827dc589d20d3681
Created November 5, 2014 10:53
Lift Mongo Enum List Field Example
object enumFieldArray extends MongoListField[SomeEntity, Enum](this) {
val enum = SomeEnum
override def asDBObject: DBObject = {
val dbl = new BasicDBList
value.foreach { f => dbl.add(f.toString) }
dbl
}
override def setFromDBObject(dbo: DBObject): Box[MyType] = {
@eltimn
eltimn / 0_reuse_code.js
Created June 1, 2014 10:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@eltimn
eltimn / gist:9232958
Created February 26, 2014 16:24
GIT: ignoring changes in tracked files
There may be times when you want to edit some variables in for example a database connection file, to run an application right from within your GIT repo. Of course you don’t wont those changes to be commited, so you add the file the .gitignore.
However adding tracked files to .gitignore won’t work because GIT will still track the changes and commit the file if you use the -a parameter.
Fortunately GIT has a very easy solution for this, just run the following command on the file or path you want to ignore the changes of:
git update-index --assume-unchanged <file>
If you wanna start tracking changes again run the following command:
git update-index --no-assume-unchanged <file>
You can find more info about this in the git manual.
@eltimn
eltimn / Build.scala
Last active December 22, 2015 12:49
SBT build with deploy.
import sbt._
import sbt.Keys._
object MyBuild extends Build {
import Dependencies._
import BuildSettings._
lazy val main = Project("root", file("."))
.settings(mainWebSettings: _*)
.settings(
@eltimn
eltimn / MarkdownTypedField.scala
Last active December 15, 2015 16:59
A lift Record Field for storing and converting Markdown. Uses Actuarius - https://github.com/chenkelmann/actuarius
package code.model
import scala.xml._
import net.liftweb.util._
import net.liftweb.common._
import net.liftweb.http.S
import net.liftweb.record._
import net.liftweb.record.field._
import S._
@eltimn
eltimn / KoForm.scala
Created December 12, 2012 23:48
This is an example of using knockout.js with Lift to create a form. It allows you to utilize all of knockout's form capabilities combined with Lift's built-in ajax callbacks. AnonFunc is used to create a JavaScript function that is passed to the view model and called when the form is submitted.
package code.snippet
import net.liftweb._
import http.js._
import http.js.JE._
import http.js.JsCmds._
import http.json._
import util.Helpers._
object KoForm {