Skip to content

Instantly share code, notes, and snippets.

nmccready nmccready

Block or report user

Report or block nmccready

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View killTomcat
#!/bin/sh
kill -9 $(echo `ps aux | grep tomcat | grep -v grep |awk '{print $2}'`)
View LRUCache.scala
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
View lru-cache.coffee
class LRUCache
constructor: (size_limit) ->
@limit = size_limit or Infinity
@data = {}
@size = 0
@order = []
set: (key, val) ->
@data[key] = val
@size++
@order.push key
View .ctags_coffee
--langdef=coffee
--langmap=coffee:.coffee
--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
nmccready / gulpfile.coffee
Created Jun 30, 2014
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.
View gulpfile.coffee
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"]
View gulpfile.coffee
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
nmccready / gulpfile.coffee
Created Jun 30, 2014
gulp async bs, nothing waits here, this just means default runs one, two, three and they are parallel
View gulpfile.coffee
gulp.task "one", ->
gulp.task "two", ->
gulp.task "three", ->
gulp.task "default" ["one","two","three"]
@nmccready
nmccready / dynamic-height.css
Created Jul 30, 2014
Example for html on angular google maps for having dynamic height.
View dynamic-height.css
/*
let me google that for you (many ways to skin this cat)
http://stackoverflow.com/questions/10209704/set-google-maps-container-div-width-and-height-100 (implemented here)
http://stackoverflow.com/questions/2821596/100-height-with-fixed-footer-and-embedded-google-map
*/
body, html {
height: 100%;
width: 100%;
}
@nmccready
nmccready / de-crapify-google-plus.css
Created Sep 8, 2014
CSS to only show google hangouts on plus.google.com homepage
View de-crapify-google-plus.css
/* your source here */
.Bdc.FQb{
display:none;
}
.vyd{
display:none;
}
.Of.ooe.Xt.N3.gb_gbsf.gb_gbshc{
@nmccready
nmccready / gist:b11c8cfb6eedde5ac82e
Created Sep 10, 2014
example of using lsof and awk to get just a pid of a running process on a specific port.
View gist:b11c8cfb6eedde5ac82e
#!/bin/sh
port=${1:-8000}
lsof -i:$port | grep -v PID | awk '{print $2}'
You can’t perform that action at this time.