Skip to content

Instantly share code, notes, and snippets.

View diegogangl's full-sized avatar

Diego Gangl diegogangl

View GitHub Profile
@diegogangl
diegogangl / zajalSaveFrames.rb
Created May 11, 2012 23:01
A little snippet you can put in your draw function to save every frame to your desktop (or any other path).
# Save frames to png images in Zajal 0.3.3
def saveFrames
image = grab_screen
path = '/Users/yourName/Desktop/frame_ ' + frame.to_s() + '.png'
image.save( path )
end
@diegogangl
diegogangl / zajalAnimation.rb
Created May 11, 2012 22:30
A simple animation in Zajal 0.3.3, a circle that grows and shrinks over time.
# Simple animation example
# in Zajal
sizeBase = 0
speed = 0.05
setup do
title "Simple Circle"
framerate 60
smoothing true
@diegogangl
diegogangl / ScrolltoBottom.js
Created April 26, 2012 17:56
Simple function to smooth-scroll to the bottom of the page with a basic ease
// -------------------------------------------------------------------------------
// Metodo scrollear al final de la pagina
scrollToBottom : function()
{
var acceleration = 1;
var totalOffset = 0;
var step = 1;
var scrollTimer = setInterval( function()
@diegogangl
diegogangl / currentTaxonomy.php
Created April 10, 2012 13:30
[Wordpress 3.3] I've found that wp_list_categories doesn't highlight the current category if it's a taxonomy term (and you're in a taxonomy archive), this little snippet fixes that.
<?php
// Get the term id first
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$currentTerm = $term->term_taxonomy_id;
// This is how you'd use it in your template
wp_list_categories( array(
'taxonomy' => 'YOUR_TAXONOMY',