Skip to content

Instantly share code, notes, and snippets.


Paul Stamatiou stammy

View GitHub Profile
stammy / wp_list_articles_function.php
Created Oct 29, 2008
function to list all wordpress blog entries, by month.. for archives
View wp_list_articles_function.php
<?php function list_articles(){
global $month, $wpdb, $wp_version;
$now = current_time('mysql');
if(version_compare($wp_version, '2.1', '<')){$current_posts = "post_date < '$now'";} else {$current_posts = "post_type='post'";}
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM " . $wpdb->posts . " WHERE post_status='publish' AND $current_posts AND post_password='' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC");
foreach($arcresults as $arcresult) {
$url = get_month_link($arcresult->year, $arcresult->month);
View gist:60892
View submenu code
var submenuTimerId = 0;
var last_menu;
function submenuOver(id){
$(id).appear({duration: 0.3});
if ( ( typeof( window[ 'last_menu' ] ) != "undefined" ) && !(id == last_menu) ){
stammy / gist:91927
Created Apr 8, 2009
installing twitter_auth and it's..
View gist:91927
Aurora:skribit Paul$ script/generate twitter_auth
done loading services
The name 'User' is either already used in your application or reserved by Ruby on Rails.
Please choose an alternative and run this generator again.
drug user
substance abuser
View rewrite acts_as_taggable_on migration for apps previously using acts_as_taggable_on_steriods
class ActsAsTaggableOnMigration < ActiveRecord::Migration
def self.up
change_table :taggings do |t|
t.column :tagger_id, :integer
t.column :tagger_type, :string
t.column :context, :string
add_index :taggings, :context
View gist:103935
SELECT count(DISTINCT blogs.*) AS count_distinct_blogs_all FROM `blogs` LEFT OUTER JOIN taggings blogs_taggings ON blogs_taggings.taggable_id = AND blogs_taggings.taggable_type = 'Blog' LEFT OUTER JOIN tags blogs_tags ON = blogs_taggings.tag_id WHERE (context = 'tags' AND LIKE 'Technology') ORDER BY created_at DESC LIMIT 0, 15
View db.rake
namespace :db do
desc "abort rake if using bad memory techniques"
task :safety_migrate => :environment do
path = "#{RAILS_ROOT}/db/migrate/"
migration_directory =
proceed = true
migration_directory.each do |file|
if file != "." and file != ".."
migration ="#{path}#{file}")
text =
View .bashrc
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
# ~/code/web:master$ git checkout beta_directory
# Switched to branch "beta_directory"
View url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
# You just can't beat this:
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >>
View post-Skribit launch #FollowFriday
You can’t perform that action at this time.