Skip to content

Instantly share code, notes, and snippets.

View vjt's full-sized avatar
💭
looking at the stars

Marcello Barnaba vjt

💭
looking at the stars
View GitHub Profile
@vjt
vjt / jquery.ajax-file-upload-fu.js
Created January 29, 2009 07:38
ajax-file-upload-fu
// ~ JavaScript Kung-FU, with an excess chunky bacon dose! ~
// This plugin allows seamless ajax file uploads without having
// a fixed file input button. It achieves this by installing an
// OnMouseMove handler over the interested elements, and moving
// the input button under the cursor. <<If Muhammad won't go to
// the the mountain, the mountain will come to Muhammad.>> :-).
//
// This approach is needed on the majority of browser, except
// Safari, on which the coder is allowed to trigger a "click"
// event onto an input type=file element. On other browsers,
@vjt
vjt / placeholder.html
Created February 10, 2009 17:13
Opensource.org mirror script
<html>
<head>
<title>The mirror is currently updating. Please wait.</title>
</head>
<body>
<h2>The mirror is currently resyncing to the master site.</h2>
<h3>The process will be completed in a matter of minutes.</h3>
<p>In the meantime, try to visit the <a href="http://opensource.org">original site</a> or, if it's unreachable, try one of the following mirrors:</p>
<p><a href="http://opensource.gds.tuwien.ac.at/">Austria</a> | <a href="http://os.fsfmirror.com/">Belgium</a> | <a href="http://opensource.usrbinruby.net/">Canada</a> (<a href="http://open2.mirrors-r-us.net/">2</a>) | <a href="http://opensource.mirrors.typhon.net/">France</a> (<a href="http://os3.fsfmirror.com/">2</a>) | <a href="http://opensource.mirroring.de/">Germany</a> (<a href="http://opensource.linux-mirror.org/">2</a>,<a href="http://os2.fsfmirror.com/">3</a>,<a href="http://opensource.erde3.net/">4</a>) | <a href="http://open3.mirrors-r-us.net">Japan</a> | (<a href="http://open1.mirrors-r-us.net/">2</a>) | <a href
@vjt
vjt / blink.js
Created February 20, 2009 03:10
#!/usr/bin/env ruby
# SRT Subtitle fixer v0.5
# Applies a time or id shift to an SRT subtitle file.
#
# (C) 2008 vjt@openssl.it
#
# Usage: ./fixsrt file.srt <timeshift> [idshift]
# - timeshift: time shift in floating point (seconds)
# - idshift: subtitle id shift, integer, useful
<?php
/* Instructions: Upload to your wp-admin directory after installing WordPress and run.
*
* NOTE: You MUST install wordpress and b2evo in the same database BEFORE running the script!
*
* Original script by Fahim Farook, modified by David Appleyard and:
*
* Tom Everett - March 3, 2005
* 1. WP "post_date" is now populated from B2 "post_issue_date"
* 2. Post statuses are now migrated across
// ==UserScript==
// @name Twitter Search Results on Google
// @namespace markcarey
// @description Shows results from Twitter on Google search pages
// @include http://www.google.*/search?*q=*
// @include http://www.google.*/*
// @date 2009-05-13
// @version 1.1
// @GM_version 0.8.20080609.0
// ==/UserScript==
// Simple tabs implementation that requires the same markup as jQuery UI Tabs, but doesn't modify your
// markup or impose an horizontal layout of tabs. You're on your own setting up CSS, of course. Sample
// markup:
//
// <div id="tabs">
// <ul>
// <li><a href="#group-1">group 1</a></li>
// <li><a href="#group-2">group 2</a></li>
// </ul>
// <div id="group-1"></div>
// Just what the name says: hide the default value of a text input onFocus, and restores it if empty onBlur.
// Simple and effective, jQuery is awesome! Sample markup:
//
// <input id="search" type="text" value="Search" />
// <script type="text/javascript">$('#search').toggleDefaultValue()</script>
//
// - vjt@openssl.it
//
$.fn.toggleDefaultValue = function() {
return this.each(function() {
#!/bin/bash
# Database Dump utility for MySQL. Put in cron like this:
#
# DUMPDIR='/home/example/DatabaseDumps' USER='dbuser' PASS='dbpass' DB='dbname' /path/to/dumpdb.sh
#
# (C) 2009 vjt@openssl.it
#
[ -z "$MAXAGE" ] && MAXAGE=744
# ActiveRecord helper to manage an integer `status` column using Ruby :symbols.
# (C) 2009 Marcello Barnaba <vjt@openssl.it> - Released under the terms of the MIT License
# http://sindro.me/
#
# == Usage ==
#
# [REQUIRED] Put this file in lib/
# [OPTIONAL] Fork this gist
# [OPTIONAL] Pluginize it
# [OPTIONAL] Write some tests