Skip to content

Instantly share code, notes, and snippets.

# it is forked from https://github.com/xijo/reverse-markdown/blob/master/reverse_markdown.rb
require 'rexml/document'
require 'benchmark'
include REXML
include Benchmark
class ReverseMarkdown
# set basic variables:
# - @li_counter: numbering list item (li) tags in an ordered list (ol)
@WaYdotNET
WaYdotNET / gist:1944182
Created February 29, 2012 20:33 — forked from wisq/gist:1507733
Why I love zsh (and hate being forced to use bash)

Why I love zsh (and hate being forced to use bash)

  • Smarter completion:
  • cd tab completion -- directories only
  • bash can do this, but needs the bash-completion package, usually comes separately
  • zsh always comes with completions, why doesn't bash?
  • Filename correction during completion
  • if dir1/x exists and dir2 exists, then "dir/x<TAB>" completes to dir1/x
  • if name1 is a file and name2 is a directory with files in it, "name/<TAB>" completes to "name2/"
;; init.el
;; Vincent Foley - [email protected]
(require 'cl)
(defmacro when-package-installed (package-name &rest body)
`(if (package-installed-p ,package-name)
(progn ,@body)
(warn "package %s is not installed" ,package-name)))
@WaYdotNET
WaYdotNET / Emacs.md
Created January 18, 2012 21:37 — forked from michaelsbradleyjr/Emacs.md
Setting up Emacs daemon on OS X

Setting up Emacs daemon on OS X

Tired of waiting for emacs to start on OS X? This step by step guide will teach you how to install the latest version of emacs and configure it to start in the background (daemon mode) and use emacsclient as your main editor.

Install Homebrew

First you'll need to install the [Homebrew package manager][brew] if yo haven't already. It is amazing.

@WaYdotNET
WaYdotNET / en.yml
Created December 1, 2011 11:39 — forked from henrik/en.yml
Ruby on Rails i18n: storing locale names in their yml files and retrieving them.
# config/locales/en.yml
en:
i18n:
language:
name: 'English'
@WaYdotNET
WaYdotNET / minirecord.rake
Created November 30, 2011 13:35
Migrate All Of Your Model Classes When Using MiniRecord with Padrino
# /rake/minirecord.rake
namespace :mini_record do
desc "Auto migration of database"
task :migrate => :environment do
Dir["models/*.rb"].each do |file_path|
basename = File.basename(file_path, File.extname(file_path))
clazz = basename.camelize.constantize
clazz.auto_upgrade! if clazz.ancestors.include?(ActiveRecord::Base)
end
end
@WaYdotNET
WaYdotNET / example.rb
Created November 15, 2011 16:15 — forked from zliang-min/example.rb
You don't need a library for everything. For example, git.io :)
Git.io.generate 'https://gist.github.com/gists/1355677'
Git.io.generate 'https://github.com/gimi', 'gimi'
Git.io.recognize 'http://git.io/gimi'
# check if exist real page !
if template_exists?(params[:id], "frontend", false)
render "frontend/#{params[:id]}" and return
end
@WaYdotNET
WaYdotNET / controller.rb
Created June 23, 2011 13:57
how to render markdown page with haml template into Padrino ?
get :staff do
# render :markdown, :staff
render :markdown, :staff , :layout_engine => :haml, :layout => :application
end