Skip to content

Instantly share code, notes, and snippets.

View bojoer's full-sized avatar

Joeri Boudewijns bojoer

View GitHub Profile
@bojoer
bojoer / Install_tmux
Created September 28, 2013 05:35 — forked from simme/Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@bojoer
bojoer / 0_reuse_code.js
Created October 26, 2013 02:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bojoer
bojoer / gfm.rb
Created October 28, 2013 02:23 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
#!/usr/bin/php
<?php
$in = fopen('php://stdin', 'r');
$result=array();
$format='_.';
while($line=fgetcsv($in, 0, "\t")) {
$result[]='|'.$format.implode('|'.$format, $line).'|';
$format='';
}
fclose($in);
@bojoer
bojoer / README.md
Last active January 4, 2016 11:09 — forked from nicerobot/README.md

To run this, you can try:

curl -ks https://gist.github.com/bojoer/8613437/raw/uninstall-node.sh | bash

Alternatively,

curl -ksO https://gist.github.com/bojoer/8613437/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh

rm uninstall-node.sh

@bojoer
bojoer / Folder Preferences
Last active December 31, 2017 01:06 — forked from chrisyour/Folder Preferences
Folder Preferences
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
<?php
$data = json_decode(file_get_contents(__DIR__ . '/currency.json'));
$code = var_export((array)$data, true);
// add gettext function call
$code = preg_replace("/'name' => '(.+)'/", "'name' => __('$1')", $code);
$code = preg_replace("/'name_plural' => '(.+)'/", "'name' => __('$1')", $code);
// save PHP code
$code = "<?php\n return " . preg_replace('/stdClass::__set_state/', '(object)', $code) . ';';
file_put_contents(__DIR__ . '/currencies.locale.php', $code);
// html2pdf.js
var page = new WebPage();
var system = require("system");
// change the paper size to letter, add some borders
// add a footer callback showing page numbers
page.paperSize = {
format: "A4",
orientation: "portrait",
footer: {
#############################################################################
# current prompt
#############################################################################
# \d – Current date
# \t – Current time
# \h – Host name
# \# – Command number
# \u – User name
# \W – Current working directory (ie: Desktop/)
# \w – Current working directory, full path (ie: /Users/Admin/Desktop)