Skip to content

Instantly share code, notes, and snippets.

@reinaldorossetti
reinaldorossetti / #drag-drop.py
Last active July 15, 2021 16:49 — forked from florentbr/#drag-drop.py
Selenium - HTML5 drag and drop
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from time import sleep
from os import getcwd
# JavaScript: Drag and drop script
# param1 (WebElement): Source element to drag
@elazarg
elazarg / find_isolated_functions.py
Last active October 22, 2016 13:41
A small script that warns about functions that are not called from within the code
#!/usr/bin/python3
from contextlib import contextmanager
from ast import NodeVisitor
import ast
import sys
import glob
class Flags:
include_strings = True
@florentbr
florentbr / #drag-drop.py
Last active March 9, 2023 14:48
Selenium - HTML5 drag and drop
from selenium import webdriver
import time
# JavaScript: HTML5 Drag and drop script
# param1 (WebElement): Source element to drag
# param2 (WebElement): Optional - target element for the drop
# param3 (int): Optional - Drop offset x relative to the target if any or source element
# param4 (int): Optional - Drop offset y relative to the target if any or source element
# param4 (int): Optional - Delay in milliseconds (default = 1ms) for dragging and dropping
# param5 (string): Optional - Key pressed (alt or ctrl or shilf)
@cmgiven
cmgiven / .block
Last active October 27, 2019 19:52
Interactive General Update Pattern
license: mit
height: 640
@veltman
veltman / README.md
Created July 11, 2016 03:05
Argyle

Infinite argyle with random ColorBrewer and d3 4.0 color scales.

@kdzwinel
kdzwinel / main.js
Last active June 7, 2024 08:08
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.
@druska
druska / native_js_drag_and_drop_helper.js
Created August 26, 2015 03:56
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)
@kuy
kuy / pre-commit
Last active November 10, 2021 03:52
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]
then
echo "'FIXME' tag is detected."
echo "Please fix it before committing."
echo " ${matches}"
exit 1
@drinkcat
drinkcat / Performance
Last active November 28, 2019 10:32
Shell implementation of cpio
time sudo cpio -idm < ../bash-4.2-37.4.mga3.x86_64.cpiodec
Proper cpio:
real 0m0.031s
user 0m0.003s
sys 0m0.027s
Using dd:
real 0m3.277s
user 0m0.103s
@brysongilbert
brysongilbert / gist:6062276
Last active March 26, 2022 00:17
CSS colour invert via SVG filter for Webkit, Firefox, and Internet Explorer 6-8.
/* WebKit */
-webkit-filter: invert();
/* Firefox */
filter: url("data:image/svg+xml;utf8,<svg height='0' xmlns='http://www.w3.org/2000/svg'><filter id='negative'><feColorMatrix values='-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0'/></filter></svg>#negative");
/* IE 6-7 */
filter: progid:DXImageTransform.Microsoft.BasicImage(invert=1);
/* IE 8 */
-ms-filter: 'progid:DXImageTransform.Microsoft.BasicImage(invert=1)';