Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
lucaspiller / gist:8952830
Created February 12, 2014 10:08
Ruby 1.8.6 crashes parsing YAML
$ ruby -v 1 ↵
ruby 1.8.6 (2009-08-04 patchlevel 383) [i686-darwin13.0.0]
$ irb -v
irb 0.9.5(05/04/13)
$ irb 134 ↵
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> YAML::load("--- !ruby/object:Gem::Specification\nname: multi_xml\nversion: !ruby/object:Gem::Version\n version: 0.5.1\n prerelease: \nplatform: ruby\nauthors:\n- Erik Michaels-Ober\nautorequire: \nbindir: bin\ncert_chain: []\ndate: 2012-05-10 00:00:00.000000000 Z\ndependencies:\n- !ruby/object:Gem::Dependency\n name: maruku\n requirement: !ruby/object:Gem::Requirement\n none: false\n requirements:\n - - ! '>='\n - !ruby/object:Gem::Version\n version: '0'\n type: :development\n prerelease: false\n version_requirements: !ruby/object:Gem:
@lucaspiller
lucaspiller / Building Blink on OS X.md
Last active August 24, 2017 06:25
Building Blink on OS X
@lucaspiller
lucaspiller / gist:7371780
Created November 8, 2013 14:29
GitHub.app git and Homebrew git conflict
$ brew install git
zsh: correct 'git' to '.git' [nyae]? n
Warning: A newer Command Line Tools release is available
Update them from Software Update in the App Store.
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-1.8.4.2.mavericks.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/git-1.8.4.2.mavericks.bottle.tar.gz
==> Pouring git-1.8.4.2.mavericks.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
%%%-------------------------------------------------------------------
%%% File : quad_tree.erl
%%% @author Jamie Burrell
%%% @doc Erlang implementation of a quadratic tree.
%%% @end
%%% @since 2009-02-10
%%% @end
%%%-------------------------------------------------------------------
-module(quad_tree).
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.8.21/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'curses' ]
2 info using npm@1.2.11
3 info using node@v0.8.21
4 verbose read json /Users/luca/code/1gam/march/package.json
5 verbose read json /Users/luca/code/1gam/march/package.json
6 verbose cache add [ 'curses', null ]
class CalendarController
SKIP_DAYS = 35
constructor: (@parent, @date = moment()) ->
@parent.on 'click', '[data-direction=prev]', @movePrevious
@parent.on 'click', '[data-direction=next]', @moveNext
@parent.on 'changeDate', '[data-date-picker]', @changeDate
movePrevious: (e) =>
e.preventDefault()
#!/bin/zsh
# computer activity data collection for http://jehiah.cz/one-two/
# Originally by Jehiah Czebotar. This verison by Luca Spiller.
FILE="$HOME/Dropbox/activity_log/`hostname`-`date +%Y%m%d`.log"
function log_activity()
{
local TIME=`date "+%Y-%m-%dT%H:%M:%S%z"`
local IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 ))
@lucaspiller
lucaspiller / gist:3760620
Created September 21, 2012 09:39
Zsh Bug
~ ‹1.9.3-p194› $ mkdir a
~ ‹1.9.3-p194› $ cp -r a a
cp: a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/
@lucaspiller
lucaspiller / index.html
Created September 20, 2012 23:00
Isometric CSS Test
<!-- See example at http://bl.ocks.org/3758852 -->
<html>
<head>
<title>Isometric Test</title>
<style>
.board {
-webkit-transform:matrix(1,-0.6, 1,0.6, 0,0);
-moz-transform:matrix(1,-0.6, 1,0.6, 0,0);
-o-transform:matrix(1,-0.6, 1,0.6, 0,0);
transform:matrix(1,-0.6, 1,0.6, 0,0);
@lucaspiller
lucaspiller / gist:3377737
Created August 17, 2012 10:16
Tmux Primer

I use this function to setup / resume my tmux sessions. If a session exists with the given name it resumes it, otherwise it creates it:

tm() {
  [[ -z "$1" ]] && { echo "usage: tm <session>" >&2; return 1; }
  tmux has -t $1 && tmux attach -d -t $1 || tmux new -s $1
}

(N.b. If you use something similar already check you have the -d flag. This will kill old clients (e.g. ssh connections that died, quitting your terminal before disconnecting) and ensure the window resizes correctly.)