Skip to content

Instantly share code, notes, and snippets.


Ken Snyder kensnyder

View GitHub Profile
kensnyder / 0_reuse_code.js
Created Nov 12, 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 angular.filters.nl2br.js
# Usage in html template:
"xxx | nl2br"
<div ng-bind-html=" YourString | nl2br "></div>
#! /bin/sh
# oops need to first install
# then
# init
mkdir nodejs-couchdb
cd nodejs-couchdb
# nodejs
View gist:552566
// Truncate a string to the closest word
String.prototype.truncateToWord = function(len) {
return (len = Number(len)) >= 0 ?
this.match(new RegExp('^([\\s\\S]{0,' + len + '})(:?\\s|$)'))[1] :
// Examples
// The "v" marks the first character out of bounds.