As configured in my dotfiles.
start new:
tmux
start new with session name:
| def add_method(obj, mod, &blk) | |
| obj.class_eval { define_method(mod, &blk) } | |
| end | |
| add_method(String, :greet) { "Hello, #{self}" } | |
| "world".greet #=> "Hello, world!" |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="viewport" content="user-scalable=no,initial-scale=1.0,maximum-scale=1.0" /> | |
| <style> | |
| body { padding:10px; margin:0px; background-color: #ccc; } | |
| #main { margin: 10px auto 0px auto; } | |
| </style> |
| # rackup app.ru | |
| require "./invisible" | |
| app = Invisible.new do | |
| get "/" do | |
| render do | |
| h1 "Why?" | |
| p "Because." | |
| end |
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| _.mixin({ | |
| // ### _.objMap | |
| // _.map for objects, keeps key/value associations | |
| objMap: function (input, mapper, context) { | |
| return _.reduce(input, function (obj, v, k) { | |
| obj[k] = mapper.call(context, v, k, input); | |
| return obj; | |
| }, {}, context); | |
| }, | |
| // ### _.objFilter |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
| /* bling.js */ | |
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |