<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
function chunk_split (body, chunklen, end) { | |
// http://kevin.vanzonneveld.net | |
// + original by: Paulo Freitas | |
// + input by: Brett Zamir (http://brett-zamir.me) | |
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
// + improved by: Theriault | |
// * example 1: chunk_split('Hello world!', 1, '*'); | |
// * returns 1: 'H*e*l*l*o* *w*o*r*l*d*!*' | |
// * example 2: chunk_split('Hello world!', 10, '*'); | |
// * returns 2: 'Hello worl*d!*' |
function split_to_array (body, chunklen) { | |
// * example 1: chunk_split('Hello world!', 1); | |
// * returns 1: 'H*e*l*l*o* *w*o*r*l*d*!*' | |
// * example 2: chunk_split('Hello world!', 10, '*'); | |
// * returns 2: '["Hello worl","d!"]' | |
chunklen = parseInt(chunklen, 10) || body.length; | |
if (chunklen < 1) { | |
return false; | |
} |
function bin2String(str) { | |
var regex = /\d{8}/g, | |
arr = str.match(regex), | |
result = "", | |
len = arr.length; | |
for (var i = 0; i < len; i++) { | |
result += String.fromCharCode(parseInt(array[i], 2)); | |
} | |
return result; |
function string2Bin(str) { | |
var result = []; | |
for (var i = 0; i < str.length; i++) { | |
result.push(str.charCodeAt(i).toString(2)); | |
} | |
return result; | |
} |
// Get document height (cross-browser) | |
// | |
// This function will return any document’s height. It’s been tested in IE6/7, | |
// FF2/3, Safari (Windows), Google Chrome and Opera 9.5. If the actual document’s | |
// body height is less than the viewport height then it will return the viewport | |
// height instead. | |
// | |
// @return {number} | |
function getDocHeight() { | |
var D = document; |
// Does {placeholder} substitution on a string. | |
// The object passed as the second parameter provides values to replace the {placeholder}s. | |
// | |
// usage: | |
// jQuery.substitute('{foo}', {foo:'123'}); | |
jQuery.substitute = function(str, sub) { | |
return str.replace(/\{(.+?)\}/g, function($0, $1) { | |
return $1 in sub ? sub[$1] : $0; | |
}); |
# Emulate pbcopy and pbpaste for copying to and from the pasteboard/clipboard | |
# | |
# via: http://whereswalden.com/2009/10/23/pbcopy-and-pbpaste-for-linux/ | |
alias pbcopy='xsel --clipboard --input' | |
alias pbpaste='xsel --clipboard --output' |
class PubSub(object): | |
""" | |
Very simple Pub/Sub pattern wrapper | |
using simplified Redis Pub/Sub functionality. | |
Usage (publisher):: | |
import redis | |
r = redis.Redis() |
#encoding=utf8 | |
import sublime, sublime_plugin | |
import os, base64 | |
class Image2Base64(sublime_plugin.EventListener): | |
def on_load(self, view): | |
if view.file_name(): | |
fileName, fileExtension = os.path.splitext(view.file_name()) | |
if fileExtension.lower() in conv_extensions: |