This file contains hidden or 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
desc 'Create a new draft' | |
task 'draft' do |t| | |
page, title, dir = Webby::Builder.new_page_info | |
title = Webby.site.args.raw[0] # undo the titlecasing | |
raise "Don't specify a directory for a blog post!" unless dir.empty? | |
page = File.join(Webby.site.draft_dir, File.basename(page)) | |
page = Webby::Builder.create(page, | |
:from => File.join(Webby.site.template_dir, 'blog', 'draft.erb'), |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
<% | |
@pages.find(:all, | |
:in_directory => '', | |
:extension => 'html', | |
:recursive => true, | |
:draft => nil).each do |page| | |
-%> | |
<url> |
This file contains hidden or 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
task :create_month_index, :year, :month do |t,args| | |
args.with_defaults(:year => Time.now.strftime('%Y'), :month => Time.now.strftime('%m')) | |
year = args.year | |
month = args.month | |
# ... snip ... | |
Webby::Builder.create(fn, :from => tmpl, | |
:locals => {:title => month, :directory => dir, :dirty => ("#{year}.#{month}" == Time.now.strftime('%Y.%m'))}) | |
end |
This file contains hidden or 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
sudo easy_install pip # install pip | |
sudo pip install virtualenv # install virtualenv | |
virtualenv DIR # set up virtualenv | |
source bin/activate # activate virtualenv |
This file contains hidden or 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
package main | |
import ( | |
"flag" | |
"fmt" | |
"os/exec" | |
"time" | |
) | |
type Tabata struct { |
This file contains hidden or 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
%%{ | |
machine lich; | |
action missing_size_prefix { | |
raise MissingSizePrefix.new(p) | |
} | |
action size_enter { | |
size_start = p | |
} |
This file contains hidden or 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 'pstore' | |
require 'yaml' | |
require 'letters' | |
require 'twitter' | |
require_relative './user' | |
Twitter.configure do |config| | |
YAML.load(File.open('twitter.yml')).each do |k,v| |
This file contains hidden or 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 'minitest/autorun' | |
class TestDiv < MiniTest::Unit::TestCase | |
def div(x, y) | |
return 0 if x < y | |
current = 1 | |
while x - 2 * current * y >= y | |
current *= 2 | |
end |
This file contains hidden or 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
~$ ls -R .vim | |
.vim: | |
autoload/ doc/ ftplugin/ plugin/ syntax/ | |
.vim/autoload: | |
vimwiki/ | |
.vim/autoload/vimwiki: | |
base.vim diary.vim lst.vim style.css u.vim | |
default.tpl html.vim markdown_base.vim tbl.vim |
This file contains hidden or 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
if [ -z "$CONF_DIR" ]; then | |
# CONF_DIR=$HOME/Dropbox/conf_dir | |
CONF_DIR="$( cd -P "$( dirname "${BASH_SOURCE}" )/.." && pwd )" | |
fi | |
# vim | |
ln -s $CONF_DIR/.vimrc $HOME/.vimrc | |
mkdir $HOME/.vim_backup | |
mkdir $HOME/.vim_tmp | |
mkdir $HOME/.vim_undo |