I hereby claim:
- I am anselm-helbig on github.
- I am mnemonikk (https://keybase.io/mnemonikk) on keybase.
- I have a public key ASDr7ygYF0wF1tNwE87z4eVN2qj4lL5ZoCp9nokJu2u_zAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| require 'test_helper' | |
| module Kindlemd | |
| Chapter = Struct.new(:position, :nxt, :previous) do | |
| def self.normalize(chapters) | |
| chapters = chapters.map { |h| new(h[:position]) }.sort_by(&:position) | |
| chapters.each_cons(2) { |previous, nxt| | |
| previous.nxt = nxt | |
| nxt.previous = previous |
| module Caching | |
| def cache(method) | |
| mod = Module.new do | |
| define_method(method) do |*args, &block| | |
| instance_variable_get("@#{method}") || | |
| instance_variable_set("@#{method}", super(*args, &block)) | |
| end | |
| end | |
| prepend mod | |
| end |
| #!/usr/bin/env ruby | |
| require "bundler/inline" | |
| gemfile do | |
| gem "rubyflare" | |
| gem "route53" | |
| end | |
| require "yaml" |
| require "forwardable" | |
| class Diamond | |
| class Canvas | |
| def initialize(size) | |
| @size = size | |
| end | |
| def []=(x, y, value) | |
| lines[size - y][x + size] = value |
| (setq gnus-select-method | |
| '(nnimap "wimdu" | |
| (nnimap-address "imap.gmail.com") | |
| (nnimap-server-port 993) | |
| (nnimap-stream ssl) | |
| (nnir-search-engine imap))) | |
| (add-to-list 'gnus-secondary-select-methods | |
| '(nnimap "gmail" | |
| (nnimap-address "imap.gmail.com") | |
| (nnimap-server-port 993) |
| (defun avg-dired-enter-or-find-file-other-window () | |
| (interactive) | |
| (if (file-directory-p (dired-get-file-for-visit)) | |
| (dired-view-file) | |
| (dired-find-file-other-window))) | |
| (define-key dired-mode-map (kbd "l") #'avg-dired-enter-or-find-file-other-window) |
| (defvar calsync-extract-icalendar-fixtures--fixture-regexp | |
| "<<-?\\(\\w+\\)\n\\(\\(.*\\\\r\n\\)*\\)\\1") | |
| (defun calsync-extract-icalendar-fixtures () | |
| "Extracts heredocs into icalendar fixtures." | |
| (interactive) | |
| (let ((offer-ids (calsync-extract-icalendar-fixtures--offer-ids)) | |
| (fixture-dir | |
| (format "%s/%s" (expand-file-name "../fixtures/icalendar") | |
| (calsync-extract-icalendar-fixtures--find-cassette-name)))) |
| Say you have one process in an endless loop. You know its process id: | |
| ruby -e 'puts $$; loop {}' | |
| => 30360, hangs | |
| You can attach to this process with gdb now and make it print a backtrace to stdout: | |
| gdb -p 30360 | |
| GNU gdb (GDB) 7.5 | |
| Copyright (C) 2012 Free Software Foundation, Inc. |