I hereby claim:
- I am samupl on github.
- I am samu (https://keybase.io/samu) on keybase.
- I have a public key whose fingerprint is CA73 97E9 411C FADF 5CA9 9C15 CE48 1B9F CA80 9A4F
To claim this, I am signing this object:
// Vuetify monkey patch to make sure querySelector works with shadow dom roots | |
// when used by a web component. | |
const { querySelector } = document; | |
const WEB_COMPONENTS_PATH = '/static/js/web-components/'; | |
document.querySelector = function (selector) { | |
// We're only monkey patching if data-app is being selected. | |
if (selector !== "[data-app]") return querySelector.call(this, selector); | |
// Get a list of all our web-components |
// ==UserScript== | |
// @name youtube t removal | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Remove youtube's ?t parameter | |
// @author Jakub Szafrański | |
// @match https://www.youtube.com/watch* | |
// @grant none | |
// ==/UserScript== |
// ==UserScript== | |
// @name Clippy github | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Github merge conflict clippy | |
// @author Jakub Szafrański | |
// @match https://github.com/*/pull/* | |
// @grant none | |
// ==/UserScript== |
# Based on https://hmarr.com/2010/jan/19/making-virtualenv-play-nice-with-git/ | |
# Modified to work with ZSH | |
function workon_cwd { | |
GIT_DIR=`git rev-parse --git-dir 2> /dev/null`; | |
if [[ "$?" == 0 ]]; then | |
GIT_DIR=`\cd $GIT_DIR; pwd` | |
PROJECT_ROOT=`dirname "$GIT_DIR"` | |
ENV_NAME=`basename "$PROJECT_ROOT"` |
# http://www.agile247.pl/aplikacja-zastapi-prace-scrum-masterow-nowy-produkt-od-tworcow-scruma/ | |
# :-) | |
import random | |
import subprocess | |
import time | |
def random_question(questions): | |
return random.choice(questions) |
# simple form usage in view | |
def my_view(request, template_name='home.html'): | |
# sticks in a POST or renders an empty form | |
form = MyForm(request.POST or None) | |
if form.is_valid(): | |
do_something() | |
return redirect('/') | |
return render_to_response(template_name, {'form':form}) | |
# form with files |
var putData = {}; // In my example this was from a form | |
var xhr = new XMLHttpRequest(); | |
xhr.open('PUT', 'SOME_URL', true); | |
xhr.responseType = 'arraybuffer'; | |
// xhr.setRequestHeader('X-CSRFToken', getCookie('csrftoken')); // Django CSRF | |
xhr.send(JSON.stringify(putData)); | |
xhr.onload = function(e) { | |
// Convert the array buffer to base64 and get the filename from headers. | |
// This obviously expects the Content-Disposition header with a filename attribute. | |
var arr = new Uint8Array(this.response); |
I hereby claim:
To claim this, I am signing this object: