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 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
class LRUCache
constructor: (size_limit) ->
@limit = size_limit or Infinity
@data = {}
@size = 0
@order = []
set: (key, val) ->
@data[key] = val
@order.push key
View gist:c116286d6a73b94fa21b
def run_seq(cmd):
"""Run `cmd` and yield its output lazily"""
p = subprocess.Popen(
cmd, shell=True,
# make STDIN and STDOUT non-blocking
fcntl.fcntl(p.stdin, fcntl.F_SETFL, os.O_NONBLOCK)
#shamelessly copied from
app = require '../../'
directiveName = 'postRepeat'
app.directive directiveName, [ '$log',
($log) ->
postRepeat = {}
nmccready / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View limit.maxfiles.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
View application.html.erb
<!-- File: app/views/layouts/application.html.erb -->
<%= yield %>
You can’t perform that action at this time.