./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
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
# -*- coding: utf-8 -*- | |
import unicodedata | |
""" Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """ | |
data = u'naïve café' | |
normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore') | |
print normal | |
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 | |
/* | |
* XSS filter, recursively handles HTML tags & UTF encoding | |
* Optionally handles base64 encoding | |
* | |
* ***DEPRECATION RECOMMENDED*** Not updated or maintained since 2011 | |
* A MAINTAINED & BETTER ALTERNATIVE => kses | |
* https://github.com/RichardVasquez/kses/ | |
* | |
* This was built from numerous sources |
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 | |
/** | |
* @see Unicode 6.0.0 Ch2 General Structure, rfc3629 | |
* @param int|string $codepoint e.g. 0xC9 / "U+00C9" | |
* @return string | |
*/ | |
function unicodeCodePointToUTF8($codepoint) | |
{ | |
is_string($codepoint) && sscanf($codepoint, 'U+%x', $codepoint); | |
if ($codepoint < 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
<?php | |
$value = 'A'; | |
$haystack = array('test', 0, 'A'); | |
$strict = false; | |
$s = microtime(true); | |
in_array($value, $haystack, $strict); | |
$e = microtime(true); | |
echo ' ' . ($e - $s) . PHP_EOL; |
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
{-# LANGUAGE FlexibleContexts #-} | |
import Data.Conduit | |
import qualified Data.Conduit.List as CL | |
import Network.HTTP.Conduit | |
import Control.Concurrent.Async (mapConcurrently) | |
import Control.Concurrent.MVar | |
import Control.Monad.IO.Class (liftIO) | |
import Control.Monad.Trans.Control (MonadBaseControl) |
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 | |
// Calculator.php | |
class Calculator { | |
public function getNumberFromUserInput() { | |
// complicated function to get number from user input | |
} | |
public function printToScreen($value) { | |
// another complicated function | |
} |
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 os | |
import random | |
from scrapy.conf import settings | |
class RandomUserAgentMiddleware(object): | |
def process_request(self, request, spider): | |
ua = random.choice(settings.get('USER_AGENT_LIST')) | |
if ua: | |
request.headers.setdefault('User-Agent', ua) | |
class ProxyMiddleware(object): |
OlderNewer