Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| import re | |
| from django.utils.text import compress_string | |
| from django.utils.cache import patch_vary_headers | |
| from django import http | |
| try: | |
| import settings | |
| XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS |
| //PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012 | |
| //UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler" | |
| //the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist | |
| (function(host) { | |
| function Crawler() { | |
| this.visitedURLs = {}; | |
| }; | |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from Crypto.Cipher import AES | |
| import base64 | |
| import random | |
| import hashlib | |
| import os | |
| class AesCrypt256: |
| def sanitize(untrusted_html, additional_tags=None): | |
| """Strips potentially harmful tags and attributes from HTML, but preserves | |
| all tags in a whitelist. | |
| Passing the list additional_tags will add the specified tags to the whitelist. | |
| The sanitizer does NOT encode reserved characters into XML entities. It is up | |
| to the template code, if any, to take care of that. | |
| Based on the work of: |
| #!/bin/bash | |
| # Licence: GPLv3, MIT, BSD, Apache or whatever you prefer; FREE to use, modify, copy, no obligations | |
| # Description: Bash Script to Start the process with NOHUP and & - in background, pretend to be a Daemon | |
| # Author: Andrew Bikadorov | |
| # Script v1.5 | |
| # For debugging purposes uncomment next line | |
| #set -x |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| # Based on https://github.com/sass/libsass/wiki/Building-with-autotools | |
| # Install dependencies | |
| apt-get install automake libtool | |
| # Fetch sources | |
| git clone https://github.com/sass/libsass.git | |
| git clone https://github.com/sass/sassc.git libsass/sassc | |
| # Create configure script |
| - name: Group by Distribution | |
| hosts: all | |
| tasks: | |
| - group_by: key=${ansible_distribution} | |
| - name: Set Time Zone | |
| hosts: Ubuntu | |
| gather_facts: False | |
| tasks: | |
| - name: Set timezone variables |
#Mobile Device Detection via User Agent RegEx
Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.
I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.
The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".
Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(