Skip to content

Instantly share code, notes, and snippets.

View excenter's full-sized avatar

Andrew Batz excenter

View GitHub Profile
@excenter
excenter / pageSpec.js
Created January 21, 2016 19:55
Convenience/helper function for taking screenshots using Protractor/WebDriver and NodeJS
// Example usage to check visibility (using Jasmine and Protractor)
describe('My page', function() {
it('displays "Hello World" after clicking something on the page', function() {
saveScreenshot('C:\\Users\\omouse\\Documents\\test-step-1.png');
clickSomethingOnPage();
saveScreenshot('C:\\Users\\omouse\\Documents\\test-step-2.png');
var helloWorld = element(by.css('.message'));
var helloWorldIsVisible = protractor.ExpectedConditions.visibilityOf(helloWorld);
expect(helloWorldIsVisible()).toBe(true);
@excenter
excenter / openProject.applescript
Created October 10, 2017 20:23
How to open a new iTerm window, and execute arbitrary commands.
tell application "iTerm"
activate
create window with default profile
tell current session of current window
write text "say exporting path; export PWD=~/Developer/Content/NG1/NW; say opening atom; atom $PWD; say opening sourcetree; stree $PWD; say end;"
end tell
end tell
@excenter
excenter / print_structure.py
Created January 16, 2018 17:17
Recursively print the structure (not contents) of a dict in python 2.7
blank = {}
print_structure(configs, "")
def print_structure(obj, prefix):
for key, value in obj.iteritems():
print prefix + "-" + key + ": " + str(type(value))
if isinstance(value,dict):
print_structure(value, prefix + "-")
print("crazy fizz bugs buzzy busniess")
for value in range(0,101):
mod = value%3
mod5 = value%5
if mod == 0:
print("fizz")
if mod == 0
else:
document.getElementsByTagName("video")[0].playbackRate = 3.5
# Eternal bash history.
# --------------------- http://stackoverflow.com/questions/9457233/unlimited-bash-history
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
export HISTFILE=~/.bash_eternal_history
@excenter
excenter / git-scrape.bash
Last active June 20, 2018 20:22
scrape (fetch and pull) every branch of the current git repo
git branch -r | grep -v '\->' | while read remote;
do git branch --track "${remote#origin/}" "$remote";
done;
git fetch --all;
git pull --all;
#fetch and pull every branch of the current git repo
@excenter
excenter / bashrun.js
Created June 20, 2018 20:58
a javascript function that takes a string and runs it as bash, returning the output to the std pipes.
function bashRun(command){
var exec = require('child_process').exec;
console.log(command);
var child = exec(command);
child.stdout.on('data', function(data) {
console.log('stdout: ' + data);
});
child.stderr.on('data', function(data) {
console.log('stderr: ' + data);
@excenter
excenter / template.js
Last active June 20, 2018 21:00
example string templating in node
console.log(`into ${dir}/${repo}`);
command = `
cd ${__dirname};
cd ${dir};
git clone ${url};
cd ${repo}
`;
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->