Skip to content

Instantly share code, notes, and snippets.

View nmccready's full-sized avatar

nmccready nmccready

View GitHub Profile
kill -9 $(echo `ps aux | grep tomcat | grep -v grep |awk '{print $2}'`)
import akka.stm._
import scala.collection.immutable.ListMap
case class LRUCache[A, B](private val MAX_ENTRIES: Int)
protected val cache = Ref(ListMap.empty[A, B])
def getOrElse(key: A)(fn: => B): B = {
get(key).getOrElse {
val result = fn
class LRUCache
constructor: (size_limit) ->
@limit = size_limit or Infinity
@data = {}
@size = 0
@order = []
set: (key, val) ->
@data[key] = val
@order.push key
--regex-coffee=/(^|=[ \t])*class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( extends ([A-Za-z][A-Za-z0-9_.]*)+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?(([A-Za-z][A-Za-z0-9_.]*)+):.*[-=]>.*$/\3/m,method/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/f,field/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,static field/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?/\3/f,field/
nmccready /
Created June 30, 2014 14:12
Make sure clean happens first and is finished, then execute other tasks with max parallelism . This is important as clean can be in the middle of deleting otherwise and then one,two or three could be creating files or dirs. If this happens or collides then you will get rmdir or rmfile errors inconsistently.
gulp.task "clean", ->
gulp.src('dist', read: false)
.pipe clean()
gulp.task "one", ->
gulp.task "two", ->
gulp.task "three", ->
gulp.task "default", ["clean"], ->
gulp.start ["one","two","three"]
nmccready /
Created June 30, 2014 14:12
execute in order
gulp.task "one" ->
gulp.task "two", ["one"], ->
gulp.task "three", ["two"], ->
gulp.task "default" ["one","two","three"] # now they should execute in order, this is not ideal for cleaning at all as clean may need ot be a dependency everywhere
nmccready /
Created June 30, 2014 14:13
gulp async bs, nothing waits here, this just means default runs one, two, three and they are parallel
gulp.task "one", ->
gulp.task "two", ->
gulp.task "three", ->
gulp.task "default" ["one","two","three"]
nmccready / dynamic-height.css
Created July 30, 2014 14:04
Example for html on angular google maps for having dynamic height.
let me google that for you (many ways to skin this cat) (implemented here)
body, html {
height: 100%;
width: 100%;
nmccready / de-crapify-google-plus.css
Created September 8, 2014 15:40
CSS to only show google hangouts on homepage
/* your source here */
nmccready / gist:b11c8cfb6eedde5ac82e
Created September 10, 2014 00:41
example of using lsof and awk to get just a pid of a running process on a specific port.
lsof -i:$port | grep -v PID | awk '{print $2}'