Skip to content

Instantly share code, notes, and snippets.

View arlm's full-sized avatar

Alexandre Rocha Lima e Marcondes arlm

View GitHub Profile
require 'fileutils'
class Jekyll < Thor
include FileUtils
method_options :format => :optional
def draft(name)
format = options[:format] || "markdown"
slug = name.downcase.gsub(/ +/,'-').gsub(/[^-\w]/,'').sub(/-+$/,'')
filename = slug + ".#{format}"
@ryanbriones
ryanbriones / post-receive
Created July 28, 2009 03:53
post receive hook to export a working copy and jekyll it
# "export" the working-copy to a place we can "jekyll" it.
# this can probably be done better.
git --bare --git-dir=/home/ryanbriones/sites/ryanbriones/source.git archive master | tar xC /home/ryanbriones/sites/ryanbriones/source
jekyll /home/ryanbriones/sites/ryanbriones/source /home/ryanbriones/sites/ryanbriones/public
public class ImageElement : Element {
// The original ImageElement didn't scale the picture that was displayed as the thumbnail properly
// this code probably needs lots of refactoring but I needed a quick solution.
public UIImage Value;
static RectangleF rect = new RectangleF (0, 0, dimx, dimy);
static NSString ikey = new NSString ("ikey");
UIImage scaled;
// Apple leaks this one, so share across all.
# An example Jekyll generator. Utilizes the new plugin system.
#
# 1. Make a _plugins directory in your jekyll site, and put this class in a file there.
# 2. Upon site generation, version.html will be created in your root destination with
# # the version of Jekyll that generated it
module Jekyll
class VersionReporter < Generator
safe true
require 'growl'
module Jekyll
class GrowlPreHook < Hook
safe false
sequence :pre
def run(site)
Growl.notify 'Building...', :title => 'Jekyll'
end
@ilkka
ilkka / archivepage.rb
Created November 19, 2010 19:37
Jekyll ArchivePage class
module Jekyll
class ArchivePage
include Convertible
attr_accessor :site, :pager, :name, :ext, :basename, :dir, :data, :content, :output
# Initialize new ArchivePage
# +site+ is the Site
# +month+ is the month
# +posts+ is the list of posts for the month
@ilkka
ilkka / archivegenerator.rb
Created November 20, 2010 15:44
Jekyll archive page generator plugin
module Jekyll
class ArchiveGenerator < Generator
safe true
def generate(site)
collate_by_month(site.posts).each do |month, posts|
page = ArchivePage.new(site, month, posts)
site.pages << page
end
end
@ilkka
ilkka / tag_cloud_tag.rb
Created November 22, 2010 20:07
Jekyll tag cloud / tag pages plugin
module Jekyll
class TagCloudTag < Liquid::Tag
safe = true
def initialize(tag_name, text, tokens)
super
end
def render(context)
html = ""
module Jekyll
module Filters
def summarize(str, splitstr = /\s*<div id="extended">/)
str.split(splitstr)[0]
end
end
end
@jberkel
jberkel / gist:1087757
Created July 17, 2011 16:33
HOWTO: compile mkbootimg/mkbootfs
get Android source code: http://source.android.com/source/downloading.html
$ cd /path/to/android-src
$ cd system/core/libmincrypt/
$ gcc -c *.c -I../include
$ ar rcs libmincrypt.a *.o
$ cd ../mkbootimg
$ gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
$ cd ../cpio
$ gcc mkbootfs.c -o mkbootfs -I../include