This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Wraps a substring with the given prefix and suffix in a string. | |
* | |
*@param {String} hay The string in which the replacement is to occur. | |
*@param {String} needle The string to look for. Will be wrapped without case sensitivity, but will respect the case of the original string. | |
@param {String} prefix The string to insert before `needle`. | |
@param {String} suffix The string to insert after `needle`. | |
*/ | |
function wrap(hay, needle, prefix, suffix) { | |
var lowHay = hay.toLowerCase(), | |
lowNeedle = needle.toLowerCase(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Partially upgrades a Watai test suite from v0.6 to v0.7 syntax. | |
// Usage: node upgrade-watai-06-07.js path/to/test/suite/folder [another/test/suite [another/suite …]] | |
// Only renames files. | |
var fs = require('fs'); | |
process.argv.splice(0, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description: 'Invalid fields should be clearable', | |
steps: [ | |
InputComponent.setValidatedField('2'), | |
{ 'InputComponent.validatedField': '2' }, | |
InputComponent.setValidatedField('e'), | |
{ 'InputComponent.validatedField': 'e' }, | |
InputComponent.setValidatedField('3'), | |
{ 'InputComponent.validatedField': '3' }, // fails: `e` was invalid, the field is not cleared and contains `e3` | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Returns a string that looks like a function arguments list definition. | |
* | |
*@param {Number} count How many arguments should be generated. | |
*@returns {String} An arguments declaration list usable in a Function constructor. | |
*@private | |
*/ | |
function declareArguments(count) { | |
return new Array(count).join('arg,') + 'arg'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Updates the Growl Mail plugin when unknown compatibility preemptive deactivation happens. | |
# This consists in finding the “compatibility UUID” for the new Mail version, and adding it to the supported UUIDs of GrowlMail. | |
# | |
# See http://langui.sh/2009/11/09/fixing-growlmail-letterbox-for-mail-4-2/ for more details on the procedure. | |
# | |
# Author: Matti Schneider <hi@mattischneider.fr> | |
# Either ~/Library or /Library depending on the type of install (local or global). | |
INSTALL_ROOT="/Users/`whoami`/Library/Mail/" # the default is to assume a local install | |
BUNDLE_NAME="GrowlMail.mailbundle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compares installed gems versions with the expected ones from a Gemfile. | |
# Ignores non-strict-equal dependencies (i.e. ~> 1.5 will output the same as = 1.5). | |
DEST_DIR="$HOME/Desktop/gems-comparison" # no trailing slash | |
GEMSET="mesh" | |
INSTALLED_GEMS_FILE="$DEST_DIR/installedGems.txt" | |
WANTED_GEMS_WITH_VERSIONS_FILE="$DEST_DIR/wantedGemsWithVersion.txt" | |
WANTED_GEMS_FILE="$DEST_DIR/wantedGems.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Outputs an HTML <a> list from a list of URLs, fetching destination page titles on the go | |
# param = input file, in which URLs are stored, one per line | |
for url in $(cat $1) | |
do | |
echo '<a href="'$url'">' | |
curl "$url" 2> /dev/null | grep '<title>' -A 1 | tail -1 | tr -s ' ' | |
echo '</a>' | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extract() { | |
if echo $1 | egrep -q '.pages\/?$' | |
then arg="$1" | |
trimmed="$(echo $arg | sed 's:/$::' | sed 's:\.pages::')" | |
else arg="$1.pages" | |
trimmed="$1" | |
echo "source : $arg/QuickLook/Preview.pdf" | |
echo "dest : $trimmed.pdf" | |
fi | |
if cp "$arg/QuickLook/Preview.pdf" "$trimmed.pdf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ! /usr/local/mysql/support-files/mysql.server start > /dev/null | |
then echo "MySQL package installed ? Check http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg" | |
exit 1 | |
fi | |
echo '[client] | |
socket = /var/mysql/mysql.sock | |
[mysqld] |