Skip to content

Instantly share code, notes, and snippets.

@osbornm
osbornm / bindings.js
Created December 1, 2014 19:40
KnockoutJs href binding
ko.bindingHandlers.href = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
return ko.bindingHandlers['attr']['update'](element, function () {
return { href: valueAccessor() };
}, allBindings, viewModel, bindingContext);
}
}
@JamoCA
JamoCA / ColumnToSQLList.ahk
Created July 26, 2013 15:30
AutoHotKey script to convert clipboard columnar data (from Excel or text file) to SQL-compatible comma-delimited list (adds single quotes if data consists of non-numeric values) (Windows+C)
#c:: ;Window+C Convert Columnar Data to SQL-Compatible List
StringReplace,clipboard,clipboard,`n,`,,All
StringReplace,clipboard,clipboard,`r,,All
StringGetPos, pos, clipboard, ID`, ; remove "ID" if first item in the list (Access).
if pos = 0
StringRight, clipboard, clipboard, StrLen(clipboard)-3
testString = %clipboard%
StringReplace,testString,testString,`,,,All
testString := testString * 1
if (testString is integer) {
@christophermanning
christophermanning / README.md
Created October 1, 2012 03:20 — forked from mbostock/.block
General Update Pattern, III

By adding transitions, we can more easily follow the elements as they are entered, updated and exited. Separate transitions are defined for each of the three states.

Note that no transition is applied to the merged enter + update selection; this is because it would supersede the transition already scheduled on entering and updating elements. It's possible to schedule concurrent elements by using transition.transition or by setting transition.id, but it's simpler here to only transition the x-position on update; for entering elements, the x-position is assigned statically.

Want to read more? Try these tutorials: