Skip to content

Instantly share code, notes, and snippets.

View cdlm's full-sized avatar
💭
😴

Damien Pollet cdlm

💭
😴
View GitHub Profile
@cdlm
cdlm / closure_compiler.rb
Created December 23, 2010 22:33
nanoc3 filter wrapping the google closure compiler
class ClosureCompiler < Nanoc3::Filter
identifier :closure_compiler
def run(content, params={})
IO.popen("closure --third_party true --warning_level QUIET", 'r+') do |io|
io.write content
io.close_write
io.read
end
end
@cdlm
cdlm / gist:1044968
Created June 24, 2011 15:06
Moving a Seaside app into a sub-dispatcher
#('APP' 'files') do: [ :each | |h|
(self handlerAt: 'NEW_PREFIX')
register: (self unregister: (self handlerAt: each))
at: each ]
@cdlm
cdlm / default.rb
Created July 17, 2011 10:44
My solarized iTerm2 + nanoc color fix + zsh syntax highlight
# patch nanoc's logging colors for solarized shinyness
#
# this is to work with the iTerm 2 color presets,
# which uses most of the "bright" color codes for the grayscale swatches
module Nanoc3::CLI
class Logger
(ACTION_COLORS ||= {}).update(
:create => "\e[38;5;2m",
:update => "\e[38;5;3m",
:identical => "\e[1;38;5;6m",
@cdlm
cdlm / README
Created January 23, 2012 23:51
Corrupted graphics on Mac OS X 10.7.2
This happens once a week or two, and requires a logout/relogin (apparently BezelUIServer does not exist anymore under Lion, and killing Dock or SystemUIServer has no effect)
@cdlm
cdlm / _gem
Created February 5, 2012 11:22 — forked from alexvollmer/_gem
zsh completion for rubygems
#compdef gem gem1.9
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for gem (http://rubygems.org).
#
# Source: https://gist.github.com/164465
#
# ------------------------------------------------------------------------------
@cdlm
cdlm / io-build-looks-for-lzma.txt
Created December 11, 2012 20:54
homebrew io looks for lzma
$ brew install --verbose io
==> Downloading https://github.com/stevedekorte/io/tarball/2011.09.12
Already downloaded: /Library/Caches/Homebrew/io-2011.09.12.tgz
/usr/bin/tar xf /Library/Caches/Homebrew/io-2011.09.12.tgz
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file libs/basekit/source/Common_inline.h
==> cmake .. -DCMAKE_INSTALL_PREFIX=/opt/homebrew/Cellar/io/2011.09.12 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/homebrew/Cellar/io/2011.09.12 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev
-- The C compiler identification is GNU 4.2.1
@cdlm
cdlm / cgi-escape
Last active January 3, 2016 19:59
Script to help translators of http://thecodelesscode.com
#!/usr/bin/env ruby
require 'cgi'
input = ARGV.empty? ? $stdin : StringIO(ARGV.join(' '))
input.each_line do |line|
puts CGI::escape(line.chomp)
end
@cdlm
cdlm / test.ledger
Created April 21, 2014 22:39
Ledger accout alias heisenbug
# run several times using: ledger --strict -f test.ledger balance
# most of the time it works fine
# but sometimes the account aliases fail (e.g. ledger produces a warning "Unknown account 'tools'")
# heisenbug, follow-up at http://bugs.ledger-cli.org/show_bug.cgi?id=1022
commodity €
account expenses:tools
alias tools
@cdlm
cdlm / README.md
Last active August 29, 2015 14:07
Scripts to help translating the Codeless Code (https://github.com/alessandro1997/the-codeless-code).

Helpers for translating the Codeless Code

The scripts are parameterized via environment variables (direnv), notably $CODELESS_TRANSLATION (see the help text in translate-case.rb).

  • translate-case.rb: automates the initial copy of cases from Qi's original version to a translation directory, and helps opening cases from a given translation.

  • pre-commit.rb: git hook to check for french spacing conventions (non-breaking spaces before double punctuation signs and inside quotes.

@cdlm
cdlm / README.md
Last active August 29, 2015 14:07
A puzzling wood joint…

A puzzling wood joint

First seen on Google +

Surprisingly, it took very little time to reverse-engineer it using Sketchup. The joint is symmetric around the diagonal of the cube it is inscribed into, and slides along that diagonal as well.