This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def dig(*path) | |
path.inject(self) do |location, key| | |
location.is_a?(Hash) ? location[key] : nil | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# command prefix (like screen) | |
set -g prefix C-a | |
bind C-a send-prefix | |
# basic settings | |
set-window-option -g mode-keys vi # vi key | |
set-option -g status-keys vi | |
set-window-option -g utf8 on # utf8 support | |
set-window-option -g mode-mouse off # disable mouse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def wpautop(pee, br = true) | |
return '' if pee.strip == '' | |
pee = "#{pee}\n" # just to make things a little easier, pad the end | |
pee = pee.gsub(/<br \/>\s*<br \/>/s, "\n\n") | |
# pace things out a little | |
allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; | |
pee = pee.gsub(Regexp.new('(<'+allblocks+'[^>]*>)'), "\n"+'\1') | |
pee = pee.gsub(Regexp.new('(<\/'+allblocks+'[^>]*>)'), '\1' + "\n\n") | |
pee = pee.gsub(/\r\n|\r/, "\n") # cross-platform newlines | |
if pee.include?('<object') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api = 2 | |
core = 6.x | |
projects[drupal] = 6.20 | |
projects[cck] = 2.9 | |
projects[token] = 1.16 | |
projects[filefield] = 3.10 | |
projects[imageapi] = 1.10 | |
projects[imagecache] = 2.0-beta12 | |
projects[imagefield] = 3.10 | |
projects[thickbox] = 1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sass::Engine::DEFAULT_OPTIONS[:load_paths].tap do |load_paths| | |
load_paths << "#{Rails.root}/app/assets/stylesheets" | |
load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets" | |
load_paths << "#{Gem.loaded_specs['html5-boilerplate'].full_gem_path}/stylesheets" | |
load_paths << "#{Gem.loaded_specs['fancy-buttons'].full_gem_path}/lib/stylesheets" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Screen <Formula | |
homepage 'http://www.gnu.org/software/screen/' | |
url 'http://ftp.gnu.org/gnu/screen/screen-4.0.3.tar.gz' | |
md5 '8506fd205028a96c741e4037de6e3c42' | |
# brew install --HEAD to get the latests, includes vertical split, mapped | |
# to C-a | | |
head 'git://git.savannah.gnu.org/screen.git', :branch => 'master' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'slim' | |
Slim::Engine.set_default_options :pretty => true | |
desc "Parse .slim layouts, ignoring any YAML front matter." | |
task :parse_slim do | |
print "Parsing Slim layouts..." | |
Find.find('_layouts/slim/') do |filename| | |
if filename.match(/\.slim\Z/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
require 'slim' | |
Slim::Engine.set_default_options :pretty => true | |
class SlimConverter < Converter | |
safe true | |
priority :low | |
def matches(ext) | |
ext =~ /slim/i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ sample_app git:(sign-up) ✗ rails c | |
Loading development environment (Rails 3.2.6) | |
irb(main):001:0> require "capybara/rails" | |
=> true | |
irb(main):002:0> include Capybara::DSL | |
=> Object | |
irb(main):003:0> include Rails.application.routes.url_helpers | |
=> Object | |
irb(main):005:0> visit signup_path | |
=> nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/markdown_handler.rb | |
module MarkdownHandler | |
def self.erb | |
@erb ||= ActionView::Template.registered_template_handler(:erb) | |
end | |
def self.call(template) | |
compiled_source = erb.call(template) | |
"Kramdown::Document.new(begin;#{compiled_source};end, auto_ids: false).to_html" |
OlderNewer