Skip to content

Instantly share code, notes, and snippets.

set-window-option -g mode-keys emacs
set-window-option -g window-status-current-bg red
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-attr 'bold'
set-window-option -g window-status-current-attr 'bold'
set-window-option -g window-status-fg black
set-window-option -g window-status-bg white
set-window-option -g automatic-rename on
set-window-option -g utf8 on
require 'rubygems' if RUBY_VERSION < '1.9'
#require 'sinatra'
load 'sample.rb'
run SimpleNavigationApp
@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
# check if exist real page !
if template_exists?(params[:id], "frontend", false)
render "frontend/#{params[:id]}" and return
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'
@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 / 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 / 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.

;; 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)))