Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grantm/algorithm-couponcode
Perl library to generate and validate 'CouponCode' strings
https://github.com/grantm/algorithm-couponcode
coupon-code-generator javascript jquery-plugin perl widget
Last synced: 2 months ago
JSON representation
Perl library to generate and validate 'CouponCode' strings
- Host: GitHub
- URL: https://github.com/grantm/algorithm-couponcode
- Owner: grantm
- Created: 2011-05-19T09:14:37.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2024-02-28T16:44:56.000Z (11 months ago)
- Last Synced: 2024-06-21T18:49:30.857Z (7 months ago)
- Topics: coupon-code-generator, javascript, jquery-plugin, perl, widget
- Language: Perl
- Homepage: http://search.cpan.org/dist/Algorithm-CouponCode/
- Size: 67.4 KB
- Stars: 35
- Watchers: 6
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.markdown
- Changelog: Changes
Awesome Lists containing this project
README
CouponCode
==========A 'CouponCode' is a type of code that will be passed *in printed form* to
someone who will be expected to type it into a web page or other application.
The codes are random strings which are designed to be easy for the recipient to
type accurately into a web form.The following features make the codes well suited to manual transcription:
* The codes are not case sensitive.
* Not all letters and numbers are used, so if a person enters the letter 'O' we
can automatically correct it to the digit '0' (similarly for I => 1, S => 5,
Z => 2).
* The 4th character of each part is a checkdigit, so client-side scripting can
be used to highlight parts which have been mis-typed, before the code is even
submitted to the application's back-end validation.
* The checkdigit algorithm takes into account the position of the part being
keyed. So for example '1K7Q' might be valid in the first part but not in the
second so if a user typed the parts in the wrong boxes then their error could
be highlighted.
* The code generation algorithm avoids 'undesirable' codes. For example any
code in which transposed characters happen to result in a valid checkdigit
will be skipped. Any generated part which happens to spell an 'inappropriate'
4-letter word (e.g.: 'P00P') will also be skipped.Algorithm::CouponCode
---------------------This git repository contains:
* the Perl [CPAN module](http://search.cpan.org/dist/Algorithm-CouponCode/)
which implements the code generation algorithm and the server-side validation
* a [Javascript implementation](http://search.cpan.org/dist/Algorithm-CouponCode/html/index.html)
of the validator function, in the form of a jQuery plugin, which can be
included in your web application to do client-side validation and highlighting
of errorsAlternative implementations
---------------------------The code generation and server-side validation routines have been ported to
other languages (_Note: a listing here does not constitute an endorsement nor a
guarantee of compatibility_):* [Javascript for Node.js](https://www.npmjs.com/package/coupon-code)
* [Ruby](https://rubygems.org/gems/coupon_code/versions/0.0.1)
* [PHP](https://github.com/atelierdisko/coupon_code)
* [C#](https://github.com/rebeccapowell/csharp-algorithm-coupon-code)
* [Go](https://github.com/CaptainCodeman/couponcode)
* [Elixir](https://hexdocs.pm/coupon_code_ex/CouponCode.html)