Skip to content

Instantly share code, notes, and snippets.

View GLMeece's full-sized avatar

Greg Meece GLMeece

View GitHub Profile
@GLMeece
GLMeece / find_dup_ids.js
Created January 12, 2017 16:58
Find Duplicate IDs on a Web Page
javascript:(function () {
var ids = {};
var found = false;
$('[id]').each(function() {
if (this.id && ids[this.id]) {
found = true;
console.warn('Duplicate ID #'+this.id);
}
ids[this.id] = 1;
});
@GLMeece
GLMeece / robot_framework_doc_css_tweaks.md
Last active March 23, 2017 03:53
CSS Tweaks for Robot Framework's documentation tools (the testing reports, LibDoc and TestDoc)

CSS Tweak

If you wish to tweak the CSS in the reports, you'll probably want to modify the Python Lib directory's robot/htmldata/rebot/common.css file (for Linux, this is usually located in /usr/local/lib/python2.7/dist-packages; in Windows it's usually C:\Python27\Lib\site-packages). I prefer the Open Sans font, so I add the following at the top of this file:

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic);

Then, I replace 'Helvetica' with 'Open Sans' in the body's font-family declaration.

Testing reST Code Blocks

Code Block (Python):

jnk_instance = "http://jenkins.jarvis.cylancecorp.com:8080/"
jnk_user = 'myusername'
jnk_pass = 'mypassword'
my_test_run = JenkinsJobTestRunRetrieval(jnk_instance, jnk_user, jnk_pass)
@GLMeece
GLMeece / pandoc_markdown_to_word.md
Last active October 2, 2018 18:10
Using PanDoc to Convert Word to Markdown
pandoc -f docx -t markdown -o my_example_output.md my_example_input.docx
@GLMeece
GLMeece / http_bad_codes_dict.py
Created March 15, 2019 15:46
HTTP Bad Return Codes (as Python Dictionary)
http_bad_codes = {
"400": "Bad Request",
"401": "Unauthorized",
"402": "Payment Required",
"403": "Forbidden",
"404": "Not Found",
"405": "Method Not Allowed",
"406": "Not Acceptable",
"407": "Proxy Authentication Required",
"408": "Request Timeout",
@GLMeece
GLMeece / .zshrc
Created September 5, 2019 22:07
Z-shell Resource File PowerLevel9K Example
# zmodload zsh/zprof # <-- enable for shell profiling
# Note: for more options info, see:
# https://gist.github.com/geeknam/4423298046c4383d36a91c404ff049b1
# Autoload info:
# With the -U flag, alias expansion is suppressed when the function is loaded.
# -z mark the function to be autoloaded using the zsh style
autoload -Uz compinit
@GLMeece
GLMeece / open_browser_examples.robot
Last active September 27, 2019 08:55
Open Browser Examples
# Starting with a generic "Open Browser to Page" keyword, following that are examples for:
# Google Chrome
# PhantomJS
#
# Assumed global or suite variables:
# ${browser} - the browser you want to use in testing
# ${delay} - the "speed" that Selenium verbs execute at
# ${user_agent} - User Agent string like: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36
#
# Note: The documentation is written with the libdoc utility in mind. See:
@GLMeece
GLMeece / Python_Virtual_Environments.md
Last active November 25, 2019 10:25
Setting up a Virtual Environment for Python using VirtualEnvWrapper

Virtual Environments

  1. Before beginning, you should have a version of pip installed. If you don't, it is recommended you install it universally via the Terminal: sudo easy_install pip
  2. Once you do, install virtualenvwrapper: sudo pip install virtualenvwrapper. More information can be found in Read the Docs
  3. Change into the directory where your new project is; e.g., cd ~/Documents/Repos/my_new_project
  4. Create your new environment in this directory, automatically giving it the name of the current directory: thisdir=${PWD##*/};mkvirtualenv -a . -r requirements.txt $thisdir

Using Your Virtual Environment

  • To make sure you remember what your virtual environment is named (and, indeed - all you have created), execute lsvirtualenv which lists all virtual environments.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Determine whether integer is a prime or not.
- *Module*: is_prime
- *Platform*: Unix, Windows
- *Author*: [mailto:glmeece@gmail.com?subject=About is_prime.py|Greg Meece]
"""
@GLMeece
GLMeece / meta-tags.md
Last active December 24, 2020 04:37 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>