Posts tagged with “snippets”
jQuery Textarea Expander Plugin
Ok, I love Ballpark, but the thing that I'd have to say annoys me the most (aside from no time tracking) is the fact that line item descrption fields are so small.

So instead of just complaining more, I took a few minutes and put together a simple solution, a jQuery plugin anyone can implement when the page layout simply isn't designed for a large textarea box, but one is neccessary.
Essentially, it just creates a new textarea that floats on top of the selected one on focus. Pretty novel, but hopefully some people can make use of this... Ballpark? Please?
You can find Textarea Expander on Github.
Demo
Sample Usage
Load the jQuery library, included style.css and then on document load run the following.
Introducing The Most Simple Input Hint jQuery Plugin
So I decided to release my input hint plugin for jQuery because I could never find one that was portable and well written. The plugin's list of features include: the ability to specify the attribute the plugin uses to pull the hint from, by default the "title" attribute is used and it also clears itself on submit so it wont conflict with error checking.
You can find Input Hint on Github.
Demo
Sample Usage
Load the jQuery library and then on document load run the following.
Introducing a New jQuery Plugin... "Variable Input Size"
The "Variable Input Size" plugin simply resizes and input text box to fit it's value. Useful for displaying fields to users in an easier to digest manner. This plugin was inspired by a post by 37 Signals where they implemented this idea in a new iteration of Highrise's contact management page. I thought it was a great idea and wrote this as quick as I could. As described by 37 Signals:
Eventually, we explored the idea of dynamically sizing the fields. The now visible fields would shrink down to fit the name, making it read much more naturally. However, when you click the field to make a change, the field would expand to a larger size that would make it more comfortable to work inside. The text field then snaps back to size after the change.
You can find Variable Input Size on Github.
Demo
Sample Usage
Load the jQuery library and then on document load run the following.
$('input.variable').variable_input_size({default_size: 20});
Last.fm Top Artists + Chyrp
Firstly, this was originally done by Joe Laz for Tumblr, you can find that post here.
This is a variation of his Yahoo Pipe along with some instructions on getting it working with Chyrp.
Requirements
- Aggregator plugin installed.
- Yahoo Pipes Rss Feed
- Enable "link" feather
Setup
- Once you run the pipe, an rss feed link will be made available, this is what you'll give the Aggregator plugin under your "Manage" tab. (If you don't see the ability to add a feed, make sure your user group has permission to do this, this is available in "Manage -> Groups")
- You'll be importing this feed as a "link" feather and the post attributes are listed below.
- You're done!
name: "feed[title]" source: "feed[link]" description: "feed[description]"
Update:
(9/9/09) The Yahoo Pipe has been updated and now works correctly with Chyrp's Aggregator module!
Because of the way the aggregator works and because of the way yahoo pipes works, you're going to get duplicates, to prevent this, in aggregator.php replace the "main_index" method with the following. This will check if the post's title already exists as a post and wont create a duplicate.
Embedding FriendFeed into Tumblr
So I had a bit of trouble styling FriendFeed’s useful (but crappy) embed widget. The markup is horrible and the default styling are as well, they really should just mimick what Twitter does and use the page’s default css to style it.
That said, I ended up with the css template below which might just help someone embed FriendFeed into their Tumblr account, or really anywhere…
#friendfeed {
width: 200px !important;
margin-bottom: 20px !important;
}
#friendfeed, #friendfeed * {
background: #fff !important;
border: 0 !important;
color: #000 !important;
font-size: 11px !important;
font-family: Arial, Helvetica, sans-serif !important;
}
#friendfeed .media img {
border: 1px solid #444 !important;
width: 20%;
height: 20%;
}
#friendfeed .media a:hover img {
border: 1px solid #06c5ff !important;
}
#friendfeed a {
text-decoration: none !important;
color: #000 !important;
font-weight: bold !important;
}
#friendfeed a:hover {
text-decoration: none !important;
color: #06c5ff !important;
}
#friendfeed .entry {
padding-bottom: 5px !important;
border-bottom: 1px solid #eee !important;
margin-bottom: 5px !important;
}
#friendfeed .profile {
display: none;
}
#friendfeed .body, #friendfeed .feed {
margin: 0 !important;
padding: 0 !important;
}
#friendfeed .logo {
display: none;
}
SSH2 Install for PHP
A pretty crappy, but useful script thanks to Dave…#!/bin/sh
set -e
#### User Configuration Options
# Temporary src directory - WARNING: This will be wiped clean.
SRCDIR=${HOME}/src
# Note: This *MUST* be set to your PHP5 installation directory!
PHPDIR=${HOME}/php5
PREFIXDIR=${HOME}/prefixdir
## Program Version Configuration
AUTOCONF="autoconf-2.61"
# Don't touch unless you know what you're doing!
LIBSSH2="libssh2-1.1"
LIBSSH2FEATURES="--prefix=${PREFIXDIR}"
SSH2="ssh2-0.11.0"
SSH2FEATURES="--prefix=${PREFIXDIR} --with-php-config=${PHPDIR}/bin/php-config --with-ssh2=${PREFIXDIR}"
#### END User Configuration Options
########## DO NOT MODIFY BELOW ##########
sleep 1s
# Push the install dir's bin directory into the path
export PATH=${PREFIXDIR}/bin:$PATH
export PHP_PREFIX=${PHPDIR}/bin
# Clear and/or create the src directory.
if [ -d ${SRCDIR} ]; then
echo "src directory already exists! Cleaning it..."
rm -rf $SRCDIR/*
else
echo "Creating src directory..."
mkdir -p ${SRCDIR}
fi
## Check if packages already exist and get packages the ones that don't.
cd ${SRCDIR}
# Wget options
WGETOPT="-t1 -T10 -w5 -q -c"
# Do some of our own error checking here too.
if [ -a ${SRCDIR}/${LIBSSH2}.tar.gz ]; then
echo "Skipping wget of ${LIBSSH2}.tar.gz"
else
wget $WGETOPT http://softlayer.dl.sourceforge.net/sourceforge/libssh2/${LIBSSH2}.tar.gz
if [ -a ${SRCDIR}/${LIBSSH2}.tar.gz ]; then
echo "Got ${LIBSSH2}.tar.gz"
else
echo "Failed to get ${LIBSSH2}.tar.gz. Aborting install!"
exit 0
fi
fi
if [ -a ${SRCDIR}/${AUTOCONF}.tar.gz ]; then
echo "Skipping wget of ${AUTOCONF}.tar.gz"
else
wget $WGETOPT ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/${AUTOCONF}.tar.gz
# If primary mirror fails, use the alternative mirror.
if [ -a ${SRCDIR}/${AUTOCONF}.tar.gz ]; then
echo "Got ${AUTOCONF}.tar.gz"
else
wget $WGETOPT ftp://ftp.gnu.org/gnu/autoconf/${AUTOCONF}.tar.gz
# Check to make sure the alternative mirror worked.
if [ -a ${SRCDIR}/${AUTOCONF}.tar.gz ]; then
echo "Got ${AUTOCONF}.tar.gz"
else
echo "Failed to get ${AUTOCONF}.tar.gz. Aborting install!"
exit 0
fi
fi
fi
if [ -a ${SRCDIR}/${SSH2}.tgz ]; then
echo "Skipping wget of ${SSH2}.tgz"
else
wget $WGETOPT http://pecl.php.net/get/${SSH2}.tgz
# If primary mirror fails, use the alternative mirror.
if [ -a ${SRCDIR}/${SSH2}.tgz ]; then
echo "Got ${SSH2}.tgz"
else
echo "Failed to get ${SSH2}.tgz. Aborting install!"
exit 0
fi
fi
# Extract the src files into the src directory.
cd ${SRCDIR}
echo "Extracting ${LIBSSH2}..."
tar xzf ${SRCDIR}/${LIBSSH2}.tar.gz > /dev/null
echo "Done."
cd ${SRCDIR}
echo "Extracting ${AUTOCONF}..."
tar xzf ${SRCDIR}/${AUTOCONF}.tar.gz > /dev/null
echo "Extracting ${SSH2}..."
tar xzf ${SRCDIR}/${SSH2}.tgz > /dev/null
echo "Done."
## Compile
#AUTOCONF
cd ${SRCDIR}/${AUTOCONF}
./configure --prefix=${PREFIXDIR}
make install
#LIBSSH2
cd ${SRCDIR}/${LIBSSH2}
./configure ${LIBSSH2FEATURES}
make all install
#SSH2
cd ${SRCDIR}/${SSH2}
$PHP_PREFIX/phpize
./configure ${SSH2FEATURES}
make
# Post install clean-up.
sleep 2s
cd ${SRCDIR} && clear
## End of Install
echo "Installation completed! Your php extension should be in ${SSH2}/modules" `date +%r`
#EOF