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');
/* convISBN.js : converter ISBN10 <-> ISBN13 */ | |
/* Copyright (c) 2007 by H.Tsujimura <tsupo@na.rim.or.jp> */ | |
/* Distributed by LGPL. */ | |
/* this script written by H.Tsujimura 20 Jan 2007 */ | |
function convISBN13toISBN10(str) { | |
var s; | |
var c; | |
var checkDigit = 0; | |
var result = ""; |
#!/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 |
<?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 |
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');
<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 |
// 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; |
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 code is licensed under the terms of the MIT license | |
* | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { |
#!/usr/bin/env python | |
'''Using Webhook and self-signed certificate''' | |
# This file is an annotated example of a webhook based bot for | |
# telegram. It does not do anything useful, other than provide a quick | |
# template for whipping up a testbot. Basically, fill in the CONFIG | |
# section and run it. | |
# Dependencies (use pip to install them): | |
# - python-telegram-bot: https://github.com/leandrotoledo/python-telegram-bot |