Skip to content

Instantly share code, notes, and snippets.

# Provides a category link with a count of the number of posts in
<ul>
{% for category in site.categories %}
<li id="{{ category[0] | downcase | replace:' ', '-' }}"><a href="/{{ category[0] }}/">{{category[0] | capitalize }}</a> <span>{{ category[1] | size }}</span></li>
{% endfor %}
</ul>
# .. and the same for tags
<dl>
{% for tag in site.tags %}
#!/usr/bin/env ruby
require 'rubygems'
require 'GCal4Ruby'
# Instantiate the service
service = GCal4Ruby::Service.new
# Authentication - your google username and password
service.authenticate("USERNAME", "PASSWORD")
#!/bin/bash
# File: batch_pngcrush.sh
# Description: Batch processes PNG files using the pngcrush
# http://pmt.sourceforge.net/pngcrush/
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@shapeshed
shapeshed / twit_twurl.sh
Created June 4, 2010 12:21
Tweet from the command line using twurl & OAuth
################################
#!/usr/bin/env bash
# File: twit_twurl.sh
# Description: Tweet from the command line using twurl & OAuth
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
gifts = ['Smelly cheese', 'Pot of Gold', 'Worm in a jar', '$1.32', 'A small goat']
people = ['Willy Wonka', 'Stevie Wonder', 'Winston Churchill']
def give_gifts(gifts,people)
result = Hash.new { |h,k| h[k] = [] }
gifts = gifts.shuffle
people = people.shuffle
people_cycle = people.cycle
@shapeshed
shapeshed / ee_rename_db_prefix.rb
Created July 5, 2010 10:11
Changes the prefix of ExpressionEngine tables
#!/usr/bin/env ruby
# Changes the prefix of ExpressionEngine tables
require 'rubygems'
require 'mysql'
# Connect to db
db = Mysql.real_connect("localhost", "username", "password", "db_name")
# Get list of tables
@shapeshed
shapeshed / ee2_permissions.sh
Created July 27, 2010 11:24
Sets permissions on an ExpressionEngine 2 install
#!/bin/bash
# File: exp_permissions.sh
# Description: Sets permssions on a ExpressionEngine 2 install
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@names = %w(Ninja Hero Sensei Champ Conquerer Hotshot )
@name = @names[rand(@names.length)]
class Account < ActiveRecord::Base
has_many :memberships
has_many :users, :through => :memberships
end
# Calculate the size of selected files in GB
ls -l *.tar.gz $5 | awk '{sum = sum + $5} END {print sum/1024/1024/1024}'