Skip to content

Instantly share code, notes, and snippets.

@bloodearnest
bloodearnest / example.py
Last active April 20, 2021 14:54
Using python stdlib urllib to make requests and unit testing them
import json
from http import HTTPStatus
from urllib.request import HTTPError, Request, urlopen
def read_response_json(response):
if "application/json" in response.headers["Content-Type"]:
return json.loads(response.read().decode("utf8"))
@fta2012
fta2012 / DragTransform
Last active May 1, 2024 21:15
Slightly modified compiled coffeescript from this codepen: http://codepen.io/fta/pen/ifnqH. Paste into console on a page that has jQuery to load the two dependent libraries (jquery-ui and numericjs). Then call makeTransformable('#selector-name') to make that element WYSIWYG editable. Use inspector to get the CSS for the transforms.
var selector = 'img' // Replace this with the selector for the element you want to make transformable
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() {
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() {
(function() {
var $, applyTransform, getTransform, makeTransformable;
$ = jQuery;
# Get the directory of the current script
script_dir="$( unset CDPATH && cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"