Skip to content

Instantly share code, notes, and snippets.

View wolflee's full-sized avatar
🎯
Focusing

WolfLee wolflee

🎯
Focusing
View GitHub Profile
@wolflee
wolflee / Rakefile
Created September 3, 2012 07:03 — forked from jamesaoverton/Rakefile
Preprocess Slim layout templates for Jekyll.
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/)
@wolflee
wolflee / jekyll-gist-tag.rb
Created August 30, 2012 01:31 — forked from Crhistoph/jekyll-gist-tag.rb
Edelabar's Gist tag for Jekyll
require 'net/https'
module Jekyll
class RenderGist< Liquid::Tag
def initialize(tag_name, url, tokens)
super
tokens = url.split(' ')
@url = tokens[0]
@wolflee
wolflee / haml_converter.rb
Created August 20, 2012 01:43 — forked from radamant/haml_converter.rb
Simple haml-sass conversion for jekyll
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
@wolflee
wolflee / Tweetsheets
Created August 13, 2012 04:36 — forked from johannesnagl/Tweetsheets
Use Twitter directly in your Google Doc, so no one will ever blame you for being social
var CONSUMER_KEY = "<< YOUR KEY HERE >>";
var CONSUMER_SECRET = "<< YOUR SECRET HERE >>";
function getConsumerKey() {
return CONSUMER_KEY;
}
function getConsumerSecret() {
return CONSUMER_SECRET;
}
@wolflee
wolflee / nginx.conf
Created July 25, 2012 07:17 — forked from huacnlee/nginx.conf
Nginx http proxy cache to mirror of Rubygems.org
# 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度
# 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装
# 做这个起什么作用?
# rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。
# 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m
inactive=24h max_size=1g;
server {
listen 80;
@wolflee
wolflee / lisp.rb
Created March 31, 2012 02:53 — forked from dahlia/lisp.rb
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
@wolflee
wolflee / lithp.rb
Created March 22, 2012 04:45 — forked from fogus/lithp.rb
class Lisp
def initialize
@env = {
:label => lambda { |(name,val), _| @env[name] = val },
:quote => lambda { |sexpr, _| sexpr[0] },
:car => lambda { |(list), _| list[0] },
:cdr => lambda { |(list), _| list.drop 1 },
:cons => lambda { |(e,cell), _| [e] + cell },
:eq => lambda { |(l,r), _| l == r },
:if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) },