Functions
WebDev/*nix assorted functions & hacks
Search
find all
Array
-
Bash
-
Classes
-
Config
-
DateTime
-
Debug
-
dotjs
-
File
-
foooo
-
Git
-
HTML
-
Images
-
Javascript
-
Linux
-
Math
-
Misc
-
MySQL
-
OS X
-
Reading
-
Redis
-
Shell scripts
-
snippets
-
SQL
-
Strings
-
TextMate
-
Web
-
\(^o^)/ Fun!
-
_Misc hacks
-
_Pages
Shell scripts
* Readme
dict
edit_json (php)
encrypt/decrypt
pdoc
pftp - ftp a file to some place
php fork & IPC
php input cli
phplint
~/bin/inc/lib.php
10
found
auth
Name:
Category: Shell scripts
Body:
# ONLY HERE FOR NOSTALGIA VALUE. DO NOT USE (I think it's broken) #!/usr/bin/php <?php /** * dict fetches definitions for words from dictionary.reference.com * Usage: dict {word} * Copyright 2004 M.Spreij <mac.com@nemo> under the GPL: http://www.gnu.org/licenses/gpl.txt * **/ require_once 'inc/lib.php'; $msg = "dict fetches definitions for words from dictionary.reference.com Usage: dict {word}"; if ($argc == 1) { term_echo($msg); return; } $word = $argv[1]; # Settings ini_set('display_errors', '1'); ini_set('track_errors', '1'); $url = 'http://dictionary.reference.com/search?q='; $str1 = '<!-- begin ahd4 -->'; $str2 = '<!-- end ahd4 -->'; $res = fetch_url($url . rawurlencode($word)); if (! $res[0]) { echo "Error fetching definitions, ". $res[1] ."\n"; return false; }else{ $data = $res[1]; } $start = strpos($data, $str1) + strlen($str1); $length = strpos($data, $str2) - $start; $data = strip_tags(substr($data, $start, $length)); $data = trim(substr($data, 0, strpos($data, 'Download or Buy Now') -2 )); $data = str_replace(' ', ' ', $data); echo wordwrap(html_decode($data), 80); echo "\n\n"; ?>
Footer