Skip to content

Instantly share code, notes, and snippets.

View jurriaan's full-sized avatar
:octocat:
What's happening?

Jurriaan Pruis jurriaan

:octocat:
What's happening?
View GitHub Profile
@jurriaan
jurriaan / cbs.rb
Last active November 1, 2015 11:32 — forked from koenbollen/cbs.go
ClipBoardServer (in Ruby, for OSX)
require 'webrick'
server = WEBrick::HTTPServer.new(Port: 1234)
server.mount_proc('/') { |req, res| IO.popen('pbcopy', 'w') { |io| io.write(req.body) } }
server.start
@jurriaan
jurriaan / string.format.js
Created July 25, 2011 13:20 — forked from tbranyen/string.format.js
safer string formatting
// Inspired by http://bit.ly/juSAWl
// Augment String.prototype to allow for easier formatting. This implementation
// doesn't completely destroy any existing String.prototype.format functions,
// and will stringify objects/arrays.
String.prototype.format = function(i, safe, arg) {
function format() {
var str = this, len = arguments.length+1;
// For each {0} {1} {n...} replace with the argument in that position. If