Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby
# theme
# Pry.config.theme = "vim-detailed"
# Pry.config.theme = "tomorrow"
# Pry.config.theme = "solarized"
Pry.config.theme = "pry-siberia-16"
# Pry.config.theme = "zenburn"
# Pry.config.theme = "pry-classic-256"
## based on the example at:
## http://gist.github.com/17371
##
## put me in lib/un_haml.rb (in the haml-based project)
##
## call me on the command line thus:
## $ script/runner UnHaml app/views/layouts/application.html.haml
## $ script/runner UnHaml */*/*/*.haml
##
class UnHaml < Haml::Engine
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class
# https://github.com/plataformatec/simple_form/issues/316
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
require 'mechanize'
require 'logger'
require_relative 'random_agent'
require_relative 'path'
# Mechanize::Page subclasses Mechanize::File, Mechanize::Download is its own thing
# module MimeInfo
# def size
# header["content-length"].to_i

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@jteneycke
jteneycke / newpost.rb
Created October 14, 2012 19:10 — forked from bru/newpost.rb
Creates a new Jekyll post, opens it in Geany, and adds to the git index
#!/usr/bin/env ruby
require Dir
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
blog_root = "/Users/jrk/proj/blog"
@jteneycke
jteneycke / company.rake
Created October 26, 2012 07:33 — forked from bartimaeus/company.rake
Part of my FatFreeCRM migration rake task. I've added custom fields and roles to this install of FatFreeCRM. The files used by this rake task are generated by another task that downloads them and converts then to csv files using the pipe "|" as the delimi
# Store rake tasks specific to [company]
namespace :[company] do
# Migrate [Company]'s data into the new CRM
namespace :migrate do
require 'progressbar'
desc "Run all [company] migration tasks"
task :all => [:config, :users, :comments, :accounts]
@jteneycke
jteneycke / newpost.rb
Created November 27, 2012 01:35 — forked from zanshin/newpost.rb
Ruby script to create new Octopress post, isolate it, and open it in an editor
#!/usr/bin/env ruby
#
# newpost.rb new-post-title
#
# Author: Mark Nichols, 8/2011
#
# This script automates the process of creating a new Octopress posting.
# 1. The Octopress rake new_post task is called passing in the posting name
# 2. The Octopress rake isolate taks is called to sequester all other postings in the _stash
# 3. The new file is opened in TextMate