Skip to content

Instantly share code, notes, and snippets.

View john-kurkowski's full-sized avatar

John Kurkowski john-kurkowski

View GitHub Profile
@tim-evans
tim-evans / document_title.js
Created August 22, 2014 19:28
Document title mixin for Ember.Router
import Ember from "ember";
var get = Ember.get;
var copy = Ember.copy;
var removeObserver = Ember.removeObserver;
var addObserver = Ember.addObserver;
var DocumentTitleMixin = Ember.Mixin.create({
titleTokensDidChange: function () {
@bitemyapp
bitemyapp / gist:9402223
Last active June 24, 2016 14:25
Getting Scala users moved over

Play Framework vs. the relative messiness of Yesod/Snap/Happstack/Scotty/raw WAI. Clojure has a similar (to Haskell's) story here. I'm understating it here, but this is pretty big. Most web applications are not special snowflakes, a framework to wrap-up common-case nonsense concisely is very valuable. Micro-framework stacks like using WAI directly or Scotty are good to have, but insufficient.

Specialized NLP libraries (in Java, at present) such as for medical lexicons. Might be replicable by being layered on top of existing Haskell NLP libs, but doesn't yet exist to my knowledge. Hardening up libraries like this usually takes a lot of time.

Slick is nicer and easier to get started with than Persistent. Partly due to documentation, partly because Slick isn't silly and embraces relational databases directly, partly because Persistent is just kind of hairy. Supporting MongoDB isn't a plus, it's a minus. Compromises the API anyway.

A migrations library of pretty much any sort at all.

Scala/xml equivalent i

@emk
emk / ember-test.html
Created April 7, 2013 01:44
Testing Ember.js with Mocha, Sinon and Chai, including unit and integration tests. Runnable version available at: http://jsfiddle.net/ekidd/hCsws/13/
<!-- Mocha test output goes here. -->
<div id="mocha"></div>
<!-- Handlebars templates for our application. -->
<script type="text/x-handlebars">
<h1>Testing Ember.js with Mocha</h1>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
@michaelglass
michaelglass / Coffeescript ctags
Last active December 15, 2015 05:39 — forked from Gonzih/Coffeescript ctags
allow for default assignment in constructor
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z]+\.)*([A-Za-z]+)( extends [A-Za-z_.]+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?([A-Za-z_.]+):.*[-=]>.*$/\3/m,method/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?([A-Za-z_.]+)[ \t]+=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*([A-Za-z_.]+)[ \t]+=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@([A-Za-z_.]+)[ \t]+=[^->\n]*$/\1/f,field/
--regex-coffee=/^[ \t]*@([A-Za-z_.]+):[^->\n]*$/\1/f,static field/
--regex-coffee=/^[ \t]*([A-Za-z_.]+):[^->\n]*$/\1/f,field/
@robmiller
robmiller / .vimrc
Last active February 18, 2022 11:53
Autoload sessions created by tpope's vim-obsession when starting Vim.
augroup sourcesession
autocmd!
autocmd VimEnter * nested
\ if !argc() && empty(v:this_session) && filereadable('Session.vim') |
\ source Session.vim |
\ endif
augroup END
@Rogach
Rogach / SlidingWindowMap.scala
Created September 3, 2012 03:51
SlidingWindowMap
class SlidingWindowMap(keys: Set[String], maxCount: Int, periodMs: Int) {
val times = collection.mutable.Map(keys.map(k => (k, Vector[Long]())).toList:_*)
def nextKey: Option[String] = {
val now = System.currentTimeMillis
this.synchronized {
val key = times.find(_._2.dropWhile(_ < now - periodMs).size < maxCount).map(_._1)
key.foreach { k => times(k) = times(k).dropWhile(_ < now - periodMs) :+ now }
key
}
}
@andreif
andreif / django-heroku.md
Created August 24, 2011 10:22
Initial Django site setup to run on Heroku (work in progress)
@joelnet
joelnet / example.html
Created June 3, 2011 18:03
Unobtrusive Knockout support library for jQuery
Choose a ticket class: <select id="tickets"></select>
<p id="ticketOutput"></p>
<script id="ticketTemplate" type="text/x-jquery-tmpl">
{{if chosenTicket}}
You have chosen <b>${ chosenTicket().name }</b>
($${ chosenTicket().price })
<button data-bind="click: resetTicket">Clear</button>
{{/if}}
anonymous
anonymous / .ctags
Created May 12, 2011 00:19
--langdef=Scala
--langmap=Scala:.scala
--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\1/o,objects/
--regex-Scala=/^[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/\1/t,traits/
--regex-Scala=/^[ \t]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/r,cclasses/
--regex-Scala=/^[ \t]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/a,aclasses/
--regex-Scala=/^[ \t]*def[ \t]*([a-zA-Z0-9_=]+)[ \t]*.*[:=]/\1/m,methods/
--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
--regex-Scala=/[ \t]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/v,variables/
@stefanfoulis
stefanfoulis / search_indexes.py
Created May 4, 2010 08:08 — forked from beniwohli/search_indexes.py
fork with support for cms placeholders (upcoming cms 2.1 release)
from django.conf import settings
from django.utils.translation import string_concat, ugettext_lazy
from django.utils.html import strip_tags
from haystack import indexes, site
from cms.models.managers import PageManager
from cms.models.pagemodel import Page
from cms.models.pluginmodel import CMSPlugin