{ Snipperize } /url
Snippets about url
Get URL Variables
Example URL: http://www.example.com/index.php?id=1&image=awesome.jpg getQueryVariable(”id”) – would return “1″. Calling getQueryVariable(”image”) – would return “awesome.jpg”.
Javascript / url, variable, query / by ThePeppersStudio (135 days, 8.65 hours ago)
Format string as machine compatible key
This snippet converts a "dirty" string that may contain special characters into a machine compatible nice looking string. That function works fine for creating urls or ID keys.
PHP / url, string, convert / by ThePeppersStudio (143 days, 14.43 hours ago)
Short URL Generator
Python implementation for generating Tiny URL- and bit.ly-like URLs. A bit-shuffling approach is used to avoid generating consecutive, predictable URLs. However, the algorithm is deterministic and will guarantee that no collisions will occur. The URL alphabet is fully customizable and may contain any number of characters. By default, digits, upper- and lower-case letters are used, with some removed to avoid confusion between characters like o, O and 0. The default alphabet is shuffled and has a prime number of characters to further improve the results of the algorithm. The block size specifies how many bits will be shuffled. The lower BLOCK_SIZE bits are reversed. Any bits higher than BLOCK_SIZE will remain as is. BLOCK_SIZE of 0 will leave all bits unaffected and the algorithm will simply be converting your integer to a different base. The intended use is that incrementing, consecutive integers will be used as keys to generate the short URLs. For example, when creating a new URL, the unique integer ID assigned by a database could be used to generate the URL by using this module. Or a simple counter may be used. As long as the same integer is not used twice, the same short URL will not be generated twice. The module supports both encoding and decoding of URLs. The min_length parameter allows you to pad the URL if you want it to be a specific length. >>> import short_url >>> url = short_url.encode_url(12) >>> print url LhKA >>> key = short_url.decode_url(url) >>> print key 12 Use the functions in the top-level of the module to use the default encoder. Otherwise, you may create your own UrlEncoder object and use its encode_url and decode_url methods.
Python / url, generator, encode, decode, deterministic / by ThePeppersStudio (159 days, 6.04 hours ago)
取得flash所在页面URL地址
Find page url of embedded swf.
ActionScript3 / url, window location, swf / by ThePeppersStudio (192 days, 8.15 hours ago)
Correct Redirect To Location
PHP / url, redirect, link / by ThePeppersStudio (215 days, 8.80 hours ago)
URL Normalization Routines
urlnorm.py - URL normalisation routines urlnorm normalises a URL by; * lowercasing the scheme and hostname * taking out default port if present (e.g., http://www.foo.com:80/) * collapsing the path (./, ../, etc) * removing the last character in the hostname if it is '.' * unquoting any %-escaped characters Available functions: norms - given a URL (string), returns a normalised URL norm - given a URL tuple, returns a normalised tuple test - test suite
Python / urlparse, format, link, url / by ThePeppersStudio (215 days, 8.85 hours ago)
Format Web Address To a Proper URL
this function formats a web address for use in a link. echo formatWebAddress("google.com"); http://www.google.com/
PHP / url, format, link / by ThePeppersStudio (220 days, 11.98 hours ago)
Convert strings into clickable url
This snippet is very useful to convert a string in a clickable link. I used this snippet for several tutorials; for example take a look at this link Simple PHP Twitter Search ready to use in your web projects where I used this snippet to convet into a clickable link all textual links contained in a tweet.
PHP / convert, url / by ThePeppersStudio (225 days, 18.29 hours ago)
- 1
- Home
- New Snippet
- Languages
-

