Skip to content

Instantly share code, notes, and snippets.

View studiomohawk's full-sized avatar

Yuya Saito studiomohawk

View GitHub Profile
@henrik
henrik / wordpress.rb
Created April 22, 2009 22:33
Standard Jekyll WordPress import script modified for tags and some custom fixups.
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'cgi'
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="/js/autocomplete.js" type="text/javascript"></script>
<title>Testing your mom - nevercraft.net</title>
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function($) {
$('input#searchfield').autocomplete('/js/posts.json');
#!/bin/bash
for i in *.git ; do
( cd $i
RES=$(git status | grep -E '^# (Changes|Changed|Untracked)')
STAT=""
grep -e 'Untracked' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="[Untracked]"
fi
@johngrimes
johngrimes / image_optimisation.sh
Created June 3, 2010 04:51
Optimise JPEG and PNG images
find public/images -name '*.png' | xargs optipng
find public/images -name '*.jpg' | xargs jpegoptim
<!DOCTYPE HTML>
<html>
<head>
<title>DailyJS Boomerang Example</title>
</head>
<body>
<h1>Boomerang Test</h1>
<div id="results">
</div>
@josegonzalez
josegonzalez / category.rb
Created August 14, 2010 21:41
Category plugin for Jekyll
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
@andyfowler
andyfowler / lessjs.rb
Created October 23, 2010 21:46
Jekyll plugin to render less.js - fixed for new versions of jekyll
module Jekyll
class LessCssFile < StaticFile
def write(dest)
# do nothing
end
end
# Expects a lessc: key in your _config.yml file with the path to a local less.js/bin/lessc
# Less.js will require node.js to be installed

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@alx
alx / git.rb
Created December 6, 2010 14:24
Jekyll plugin to add Git activity inside a list
require 'git'
module Jekyll
class GitActivityTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)
@cjohansen
cjohansen / gist:739589
Created December 13, 2010 20:55
Showing how to fake server requests with Sinon.JS and Jasmine
/*
Load Sinon.JS in the SpecRunner:
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script>
<script type="text/javascript" src="sinon-1.0.0.js"></script>
<script type="text/javascript" src="sinon-ie-1.0.0.js"></script>
http://cjohansen.no/sinon/
*/