This file contains 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
SELECT CONCAT( 'ALTER TABLE ', TABLE_SCHEMA,'.',TABLE_NAME , ' MODIFY ', COLUMN_NAME, ' ', DATA_TYPE , '(', CHARACTER_MAXIMUM_LENGTH , ') CHARACTER SET utf8 ;' ) FROM COLUMNS WHERE TABLE_SCHEMA = 'vpd1' AND CHARACTER_SET_NAME != 'utf8'; |
This file contains 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
import hashlib | |
def gen_token(clientid, secret, length=512): | |
clientid_token = hashlib.sha512(clientid).hexdigest() | |
secret_token = hashlib.sha512(secret).hexdigest() | |
token = secret_token+clientid_token | |
token = hex(pow(int(str(token), 16), 2)).replace('0x','') | |
b = 1 | |
# Change divisor +/- to increase / decrease length | |
div = 512/length |
This file contains 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 | |
/** | |
* Rotates an array for the round robin algorithm | |
*/ | |
function round_robin_array($array) | |
{ | |
// we always keep index 0 | |
$top = array_shift($array); | |
$last = array_pop($array); |
This file contains 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
<Genre-Reference><Genre> | |
<Id>16</Id> | |
<Name>Reggae/Ska</Name> | |
<Genre-Category>MUSIC</Genre-Category> | |
<Genre-Type>MAIN</Genre-Type> | |
<Created-Date>2001-04-24</Created-Date> | |
<Last-Updated-Date>2001-04-24</Last-Updated-Date> | |
</Genre> | |
<Genre> | |
<Id>20</Id> |
This file contains 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
$.fn.click_hold = function(fn, delay) { | |
var timeout = 0; | |
$(this).live("mousedown", function(evt) { | |
var $this = $(this).data("mousedown", true); | |
timeout = setInterval(function() { | |
if ($this.data("mousedown") === true) { | |
console.log("held"); | |
fn(evt); | |
} else { | |
console.log("released"); |
This file contains 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
def does_exist(tbl, where = None, where_field = 'id'): | |
"""Builds a MySQL SELECT statement | |
""" | |
where_clause = "WHERE `%s` = %%s" % where_field | |
query = "SELECT COUNT(`id`) AS total FROM %s %s" % ( | |
tbl, where_clause | |
) | |
cur.execute(query, (where,)) | |
return cur.rownumber != 0 |
This file contains 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
spl_autoload_register(function($file) { | |
if (!defined('PRGGMR_VERSION')) { | |
if (strpos($file, 'prggmr') !== false) { | |
include_once 'prggmr/prggmr.php'; | |
} | |
} | |
}); |