Skip to content

Instantly share code, notes, and snippets.

View cpoile's full-sized avatar

Christopher Poile cpoile

View GitHub Profile
;; built on: https://gist.github.com/zdavkeos/1279865
;; and ediff-util (GNU Emacs)
;;
;; diff-region-with-killring* - Diff the current region with the
;; region that was most recently killed (cut or copied). The
;; highlighted region is called Region.B during the ediff session.
;; Changes made to the highlighted region (Region.B) will be saved
;; when quitting the ediff session. This is designed to be similar to
;; the 'compare with clipboard' function in IntelliJ IDEA.
;;
@cpoile
cpoile / DataHolder.coffee
Created May 8, 2012 22:01 — forked from Shadowfiend/DataHolder.coffee
DataHolder is used to manage model objects with knockout observable values.
# DataHolder handles most Knockout binding situations for properties
# transparently. You can instantiate a DataHolder with a set of attributes
# that are turned into observable properties of the DataHolder.
#
# Attributes passed in that are functions are not wrapped in an observable.
# Additionally, all attributes whose names end in `Fn' are ensured to be
# wrapped in functions and set as is, without an observable.
#
# All attributes are passed through the preprocessAttribute function, which
# can be overridden in child classes. These can be used to do type
@cpoile
cpoile / package.scala
Created May 8, 2012 22:01 — forked from Shadowfiend/package.scala
Functions for extracting field names for Lift server-side functions as Strings.
package com {
package object openstudy {
def nameForStringField(fn:(String)=>Any) : String = {
S.fmapFunc(S.SFuncHolder(string => fn(string)))((name:String) => name)
}
def nameForFileUploadField(fn:(FileParamHolder)=>Any) : String = {
S.fmapFunc(S.BinFuncHolder(fph => if (fph.length > 0) fn(fph)))((name:String) => name)
}
def nameForSubmitButton(fn:()=>JsCmd) : String = {
S.fmapFunc(S.NFuncHolder(fn))((name:String) => name)