Skip to content

Instantly share code, notes, and snippets.

View oliverguenther's full-sized avatar

Oliver Günther oliverguenther

View GitHub Profile
@florentbr
florentbr / #wd-drop-file.py
Last active April 7, 2024 02:56
Selenium - Drop a file from the desktop on a drop area
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
import os.path
# JavaScript: HTML5 File drop
# source : https://gist.github.com/florentbr/0eff8b785e85e93ecc3ce500169bd676
# param1 WebElement : Drop area element
# param2 Double : Optional - Drop offset x relative to the top/left corner of the drop area. Center if 0.
# param3 Double : Optional - Drop offset y relative to the top/left corner of the drop area. Center if 0.
# return WebElement : File input
@skanev
skanev / rubocop.rb
Last active March 13, 2024 08:24
A Rubocop wrapper that checks only added/modified code
#!/usr/bin/env ruby
# A sneaky wrapper around Rubocop that allows you to run it only against
# the recent changes, as opposed to the whole project. It lets you
# enforce the style guide for new/modified code only, as opposed to
# having to restyle everything or adding cops incrementally. It relies
# on git to figure out which files to check.
#
# Here are some options you can pass in addition to the ones in rubocop:
#
@unicornist
unicornist / caretRangeFromPoint.js
Last active August 30, 2023 01:39
Cross browser caretRangeFromPoint
//demo: http://jsfiddle.net/heZ4z/
if (document.addEventListener) { // standard
document.addEventListener('click', function onclick(e) {
var r;
if (document.caretRangeFromPoint) { // standard (WebKit)
r = document.caretRangeFromPoint(e.pageX, e.pageY);
} else if (e.rangeParent) { // Mozilla
r = document.createRange();
@eligrey
eligrey / chrome-i18n.js
Last active January 11, 2020 11:16
Easy i18n for your Chrome extensions and apps' DOM.
/* Chrome DOM i18n: Easy i18n for your Chrome extensions and apps' DOM.
* 2011-06-22
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*jslint laxbreak: true, strict: true*/
/*global self, chrome, document*/