Skip to content

Instantly share code, notes, and snippets.

@damphyr
damphyr / pdfkit_0.5.3_windows_bug.rb
Created July 4, 2013 12:35
Reproduces the pdfkit 0.5.3 behaviour with paths that contain spaces on Windows. Tested with RubyInstaller Ruby 1.9.3p392
require 'pdfkit'
def reproduce html,output,path_to_wk
PDFKit.configure do |config|
config.wkhtmltopdf = path_to_wk
end
kit=PDFKit.new(html,:page_size=>'A4')
kit.to_file(output)
end
@damphyr
damphyr / Robot.ino
Created November 17, 2013 15:40
ATCAR
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
int potpin = 0; // analog pin used to connect the potentiometer
int mode=1;
void setup()
{
INFO global: Vagrant version: 1.6.3
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_DETECTED_OS="MINGW32_NT-6.1"
INFO global: VAGRANT_EXECUTABLE="d:/tools/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="d:/tools/Vagrant/bin/../embedded"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
INFO global: VAGRANT_LOG="debug"
@damphyr
damphyr / keybase.md
Created September 23, 2014 08:13
keybase.md

Keybase proof

I hereby claim:

  • I am damphyr on github.
  • I am arcandros (https://keybase.io/arcandros) on keybase.
  • I have a public key whose fingerprint is D1E4 FC0C 45A3 9A3D 3162 F7D1 99B7 A1A5 F690 9409

To claim this, I am signing this object:

@damphyr
damphyr / tokenizer.rb
Created June 5, 2015 11:33
Diesel tokenizer
module Diesel
module Tokenize
attr_accessor :input
def tokenize source
tokens = Array.new
source.each do |line|
# Comment Type 1: Completely ignore all text between '##' and EOL
input = line.gsub(/##.*$/, "").strip
# Comment Type 2: Interpret all text between '%%' and EOL as docs
parts = input.split("%%")