This file contains 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
# 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 %} |
This file contains 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
#!/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") |
This file contains 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
#!/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 |
This file contains 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
################################ | |
#!/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 |
This file contains 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
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 |
This file contains 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
#!/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 |
This file contains 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
#!/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 | |
# |
This file contains 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
@names = %w(Ninja Hero Sensei Champ Conquerer Hotshot ) | |
@name = @names[rand(@names.length)] |
This file contains 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
class Account < ActiveRecord::Base | |
has_many :memberships | |
has_many :users, :through => :memberships | |
end |
This file contains 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
# Calculate the size of selected files in GB | |
ls -l *.tar.gz $5 | awk '{sum = sum + $5} END {print sum/1024/1024/1024}' |