Skip to content

Instantly share code, notes, and snippets.

@devnulled
devnulled / WrappedLiftJsonResponse.scala
Created September 17, 2012 21:19
Simple Helper Class to return JSON Responses in Lift with a particular HTTP Status Code
package your.mom
import net.liftweb.http.{S, HeaderDefaults, InMemoryResponse, LiftResponse}
import net.liftweb.json.JsonAST.JValue
import net.liftweb.json._
// This is much nicer to use than the native JsonResponse in Lift
case class WrappedLiftJsonResponse(json: JValue, statusCode: Int, respHeaders: List[(String, String)] = Nil) extends LiftResponse with HeaderDefaults {
val headerContentType = "Content-Type"
val headerJsonContentValue = "application/json"
@devnulled
devnulled / gist:3756734
Created September 20, 2012 15:51
Eclipse JVM Arguments for Speed and Stability
These additional/replacement JVM arguments for Eclipse seem to work pretty well.
I believe I got them from a blog at some point, but no idea where.
Please backup your original config and change at your own peril.
-XX:MaxPermSize=512m
-Xms40m
-Xmx2048m
-XX:+UseParallelGC
@devnulled
devnulled / gist:3883718
Created October 13, 2012 07:42
Static File Webserver in Scala
package scalawebserver
import java.net._
import com.sun.net.httpserver._
class Handler extends HttpHandler {
import java.io._
import java.nio._
import scala.io.Source
@devnulled
devnulled / idea.vmoptions
Last active May 23, 2018 09:36
Java VM Arguments for IntelliJ + Scala + Grails
-Xms1024m
-Xmx2048m
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=128m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
-server
-XX:NewSize=128m
-XX:+UseParNewGC
-XX:ParallelGCThreads=8
@devnulled
devnulled / gist:4946216
Created February 13, 2013 17:13
I can never quite remember the form for GitHub Enteprise URLs for published pages. Here is how the URL's are accessed.
GitHub Pages URLs on an Enterprise instance take the form of http(s)://[hostname]/pages/[user]/[repo]
@devnulled
devnulled / gist:5716661
Created June 5, 2013 19:42
Add An External Configuration File to a Grails Project

How To Create An External Configuration File in Grails

Note, this information is taken from user Big Ed at StackOverflow. Thanks Ed!

Ed's Answer

Create a properties file myExternalProperties.groovy and put it on your classpath (such as the $TOMCAT_HOME/lib directory).

Create a configuration file grails-app/conf/MyConfig.groovy to use the external configuration values (if needed). You will not be able to use the properties defined in myExternalProperties.groovy within grails-app/conf/Config.groovy.

@devnulled
devnulled / project_documentation_methods.md
Created November 25, 2013 18:01
Ways I've ran across to implement documentation for a project, particularly in GitHub.

GitHub Project Documentation Methods

Just a quick guide on methods I've seen to document GitHub projects. This is not a complete list by any means, just things I've ran across and bookmarked.

More Common

  • GitHub Wiki's
  • GitHub Sites
  • A directory of markdown or AsciiDoc files
  • Sphinx generated documentation

Keybase proof

I hereby claim:

  • I am devnulled on github.
  • I am devnulled (https://keybase.io/devnulled) on keybase.
  • I have a public key whose fingerprint is 8B20 AB7F 1079 A02E 80BE 487D 2874 2656 D1B0 C961

To claim this, I am signing this object:

@devnulled
devnulled / 0_reuse_code.js
Last active August 29, 2015 14:16
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
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l for l in output.splitlines() if 'CurrentCapacity' in l][0]