Skip to content

Instantly share code, notes, and snippets.

View denisdefreyne's full-sized avatar

Denis Defreyne denisdefreyne

View GitHub Profile
def _system(*args)
system('echo', *args)
system(*args)
end
class CreateDependenciesFilter < Nanoc3::Filter
identifier :create_dependencies
type :binary
#!/usr/bin/env ruby
preprocess do
items << Nanoc3::Item.new(
'',
{},
'/exe/',
:binary => true)
end
array = [ 1, 2, 3 ]
array.hash
# => -239251530248082591
dict = {}
dict[array] = 123
array << 4
array.hash
# => -3202532316789943903
dict[array]
# => nil
def modify(&block)
puts block.arity
end
modify {}
# 1.8.7:
# -1
# 1.9.2:
# 0
{
"^m" = {
"^m" = {
"?" = {
"!" = ("insertText:", "\U203D"); /* ‽ */
};
"o" = {
"/" = {
"\\~" = ("insertText:", "\U266A"); /* ♪ */
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
class ToTextFilter < ::Nanoc3::Filter
identifier :to_text
type :binary => :text
def run(filename, params={})
File.read(filename)
end
end
class ToBinaryFilter < ::Nanoc3::Filter
identifier :to_binary
# encoding: utf-8
Encoding.default_internal = Encoding::UTF_8
require 'pstore'
store = PStore.new('blah')
store.transaction do
store[:foo] = '…'
end
ectype ✗ ~ ▸ uptime
19:25:49 up 611 days, 7:41, 1 user, load average: 0.11, 0.30, 0.29
ectype ✓ ~ ▸
Broadcast message from root@ectype (Tue Aug 16 19:26:08 2011):
The system is going down for system halt NOW!
Connection to ectype closed by remote host.
Connection to ectype closed.
100
"method"
nil
"local-variable"