Techy Things

Wait until document loaded 0

Wait until document loaded

if (document.readyState === “complete”) { bindAdminUpload(); } else { addEvent(window, “load”, function() { bindAdminUpload(); }); }

Waiting until jQuery and or other library loaded 0

Waiting until jQuery and or other library loaded

This is the routine I use when the framework at use doesn’t provide dependency loading or if there is no framework var runWhenAvailable = function() { if (typeof jQuery === “undefined” || typeof jQuery.fn.hvTooltip ===...

NameError: global name ‘By’ is not defined 0

NameError: global name ‘By’ is not defined

Problem: Traceback (most recent call last): File “seleniumPhantomJS.py”, line 153, in selenium_phantom_web_direct_rtp_create_test(“10.65.11.145″) File “seleniumPhantomJS.py”, line 118, in selenium_phantom_web_direct_rtp_create_test isPresent = is_element_present(driver, By.CSS_SELECTOR, “article.notifier-log”) NameError: global name ‘By’ is not defined [flemieux@atom makito]$ NameError: global...

Excluding files from tar 0

Excluding files from tar

This is what I use to backup the public_html of a site on Virtualmin: tar -czf site-backup-`date +%Y-%m-%d,%Hh%M`.tar.gz ./public_html/ –exclude “./public_html/stats” –exclude “./public_html/awstats*”

Javascript hostname and ip validate 0

Javascript hostname and ip validate

Validating hostname and IP occurs pretty often. This is what I use for a field that can contain both IPV4 or hostname : if (value.length === 0 || value.length > 511) { return “Address...