Skip to content

Instantly share code, notes, and snippets.

@wvega
wvega / google-reader-imdb-link.user.js
Created February 6, 2011 22:15
An User script to show IMBD links in Google Reader
@wvega
wvega / mendeley-install.sh
Created February 9, 2011 23:20
Install Mendeley on Fedora
#!/bin/sh
ARCH=`uname -m`
INSTALL=/usr/local/mendeley
# As noted by Narendiran Anandan in http://disq.us/26v7yj,
# required OpenSSL libraries are availabe only at the following locations:
# http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/11/Fedora/x86_64/os/Packages/openssl-0.9.8k-1.fc11.x86_64.rpm
# http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/11/Fedora/i386/os/Packages/openssl-0.9.8k-1.fc11.i586|i686.rpm
case $ARCH in
@wvega
wvega / staff-directory-0.8.04b-multiple-categories.patch
Created March 27, 2011 21:07
Add support to Staff Directory 0.8.04b for asigning multiple categories to a single member staff.
# Add support to Staff Directory 0.8.04b for asigning multiple categories to a single member staff.
# Willington Vega <wvega@wvega.com>
diff -ur staff-directory-0.8.04b/admin/admin-functions.php staff-directory-0.8.04b-multiple-categories/admin/admin-functions.php
--- staff-directory-0.8.04b/admin/admin-functions.php 2010-04-07 23:52:31.000000000 -0500
+++ staff-directory-0.8.04b-multiple-categories/admin/admin-functions.php 2011-03-19 17:46:43.621885003 -0500
@@ -18,6 +18,9 @@
if($photo != '' AND is_file(STAFF_PHOTOS_DIRECTORY . $photo)) unlink(STAFF_PHOTOS_DIRECTORY . $photo);
$sql = "DELETE FROM " . STAFF_DIRECTORY_TABLE . " WHERE `staff_id` = " . $select[$i];
$wpdb->get_results($sql);
+ // delete category associations for this member
@wvega
wvega / image_processing.php
Created April 2, 2011 20:01
Modified version of image_processing.php file from WP e Commerce plugin - Stable Tag: 3.7.8
<?php
function image_processing($image_input, $image_output, $width = null, $height = null,$imagefield='') {
global $wpdb;
/*
* this handles all resizing of images that results in a file being saved, if no width and height is supplied, then it just copies the image
*/
$imagetype = getimagesize($image_input);
if(file_exists($image_input) && is_numeric($height) && is_numeric($width) && function_exists('imagecreatefrompng') && (($height != $imagetype[1]) && ($width != $imagetype[0]))) {
switch($imagetype[2]) {
case IMAGETYPE_JPEG:
@wvega
wvega / image_processing-3.7.8.php.patch
Created April 2, 2011 20:05
Patch for image_processing.php file from WP e Commerce 3.7.8 plugin to avoid cut off problems with thumbnails
diff --git a/wp-content/plugins/wp-e-commerce/image_processing.php b/wp-content/plugins/wp-e-commerce/image_processing.php
index c2c3d78..ecf2fb9 100644
--- a/wp-content/plugins/wp-e-commerce/image_processing.php
+++ b/wp-content/plugins/wp-e-commerce/image_processing.php
@@ -43,16 +43,21 @@ global $wpdb;
$temp_w = $width;
$temp_h = $height;
// if the image is wider than it is high and at least as wide as the target width.
- if (($source_h <= $source_w)) {
- if ($height < $width ) {
@wvega
wvega / mplayer.desktop
Created June 5, 2011 04:58
GNOME/KDE Desktop Entry to associate MPlayer with different MIME types
[Desktop Entry]
Name=MPlayer
TryExec=mplayer
Exec=mplayer
Terminal=false
Icon=totem
Type=Application
Categories=GTK;GNOME;AudioVideo;Audio;Video;Player;TV;
# MimeType was extracted from totem.desktop
MimeType=application/ogg;application/x-ogg;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/m4a;audio/x-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg;video/x-mpeg2;video/msvideo;video/x-msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/x-fli;video/x-theora;video/x-matroska;video/mp
@wvega
wvega / tomboy.desktop
Created June 8, 2011 12:10
GNOME/KDE Desktop Entry for Tomboy
[Desktop Entry]
Name=Tomboy Notes
GenericName=Note-taker
Comment=Simple and easy to use note-taking
Exec=tomboy
Terminal=false
Type=Application
Icon=Tomboy
Categories=Application;Utility;
StartupNotify=false
@wvega
wvega / aptana.desktop
Created June 14, 2011 03:08
GNOME/KDE Desktop Entry for Aptana
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Aptana Studio 3
Comment=The professional, open source development tool for the open web
Icon=/usr/local/aptana-studio-3/icon.xpm
GenericName=Aptana Studio
Type=Application
Exec=/usr/local/aptana-studio-3/AptanaStudio3
MimeType=text/plain;
@wvega
wvega / create-firefox-development-profile-desktop-entry.sh
Created June 29, 2011 23:14
Create a GNOME/KDE Desktop Entry for an additional Firefox profile
SOURCE=/usr/share/applications/mozilla-firefox.desktop
TARGET=~/.local/share/applications/firefox-development.desktop
sed s/"^Exec=.*"/"Exec=firefox %u -P development -no-remote"/ $SOURCE > ${TARGET}.tmp
sed s/"^Name=.*"/"Name=Firefox (Development)"/ ${TARGET}.tmp > $TARGET
rm ${TARGET}.tmp
@wvega
wvega / jquery.sandbox.js
Created July 15, 2011 23:42
jQuery Sandbox
$.fn.sandbox = function(fn) {
var element = $(this).clone(), result;
// make the element take space in the page but invisible
element.css({visibility: 'hidden', display: 'block'}).insertAfter(this);
// to override any display: none !important you may have been using
element.attr('style', element.attr('style').replace('block', 'block !important'));
result = fn.apply(element);
element.remove();
return result;
};