<?php
function randHash($len=32)
{
return substr(md5(openssl_random_pseudo_bytes(20)),-$len);
}
This file contains hidden or 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
| login url | |
| <?php echo Mage::getUrl('customer/account/login'); ?> | |
| logout url | |
| <?php echo Mage::getUrl('customer/account/logout'); ?> | |
| My Account url | |
| <?php echo Mage::getUrl('customer/account'); ?> | |
| Register url |
This file contains hidden or 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
| // Replacing callbacks with scumbacks | |
| // Promises to call you back but then doesn't | |
| // Getting your hopes up again | |
| // and again | |
| var brokenPromise = { | |
| then: doesnt | |
| }; | |
| function doesnt(callback){ | |
| return brokenPromise; |
This file contains hidden or 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
| <html> | |
| <head> | |
| <!-- | |
| In this example, I started with the 5-minute example provided by Google | |
| on the following page: | |
| https://developers.google.com/drive/ | |
| I modified the example code, so that I could write the following |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
This file contains hidden or 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
| <?php | |
| /* | |
| To make the cleaning expired carts automatic, override cleanExpiredQuotes with the following | |
| version which will also take care of the old active carts: app/code/core/Mage/Sales/Model/Observer.php | |
| */ | |
| public function cleanExpiredQuotes($schedule) | |
| { | |
| // extending limit |
This file contains hidden or 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 python | |
| # with help and inspiration from | |
| # * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure) | |
| # * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL | |
| # * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html | |
| import sys | |
| import base64 | |
| import struct |
This file contains hidden or 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
| /* convISBN.js : converter ISBN10 <-> ISBN13 */ | |
| /* Copyright (c) 2007 by H.Tsujimura <[email protected]> */ | |
| /* Distributed by LGPL. */ | |
| /* this script written by H.Tsujimura 20 Jan 2007 */ | |
| function convISBN13toISBN10(str) { | |
| var s; | |
| var c; | |
| var checkDigit = 0; | |
| var result = ""; |
NewerOlder