Skip to content

Instantly share code, notes, and snippets.

View dgrebb's full-sized avatar

Dan Grebb dgrebb

View GitHub Profile
@dgrebb
dgrebb / gist:8695622
Created January 29, 2014 19:51
Python script automates Browserstack screengrabbing
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import simplejson
# Set up an array of the browsers we test on
browser_array = [
{'browser': 'IE', 'browser_version': '8.0', 'os': 'Windows', 'os_version': '7', 'resolution': '1024x768'},
{'browser': 'IE', 'browser_version': '9.0', 'os': 'Windows', 'os_version': '7', 'resolution': '1024x768'},
{'browser': 'IE', 'browser_version': '10.0', 'os': 'Windows', 'os_version': '8', 'resolution': '1024x768'},
@dgrebb
dgrebb / gist:435e96ab7e747ef9aad5
Last active August 29, 2015 14:04
Installs and sets up homebrew, apache, mysql, and php on a mac.
#!/bin/bash
# installs and sets up homebrew, apache, mysql, and php on a mac
echo ''
echo 'Installing and configuring Homebrew.'
echo ''
# install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@dgrebb
dgrebb / sfwd-snippets.scss
Last active August 29, 2015 14:10
Sass For Web Designers code snippets
/*----------------------------------------*\
This is a collection of snippets from the
A Book Apart publication "Sass For Web
Designers", by Dan Cederholm.
\*----------------------------------------*/
$width-small: 400px;
$width-medium: 760px;
$width-large: 1200px;
@dgrebb
dgrebb / php-get-last-url-segment.php
Last active November 3, 2022 01:24
PHP - get the last URL segment
<?php
// finds the last URL segment
$urlArray = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $urlArray);
$numSegments = count($segments);
$currentSegment = $segments[$numSegments - 1];
?>
<?php if ( $currentSegment == "index.php" ) { ?>active<?php } ?>
@dgrebb
dgrebb / gist:10a49eb39de0759d6499
Created February 19, 2015 18:53
Match all opening and closing tags as well as their content
(<lastmod>)(.*)(</lastmod>)
@mixin pointer($background, $borderwidth, $bordercolor, $arrowsize, $arrowposition) {
background: $background;
border: $borderwidth solid $bordercolor;
&:after, &:before {
@if $arrowposition == 'top' {
bottom: 100%;
left: 50%;
}
@if $arrowposition == 'bottom' {
top: 100%;
/* iPhone 6 landscape */
@media only screen and (min-device-width: 375px)
and (max-device-width: 667px)
and (orientation: landscape)
and (-webkit-min-device-pixel-ratio: 2)
{ }
/* iPhone 6 portrait */
@media only screen
and (min-device-width: 375px)
### Git Time
# Add this to your .oh-my-zsh theme if you're using those, or directly to your zsh theme :)
# Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
@dgrebb
dgrebb / AutoHotKey for a Mac User with an Apple keyboard on Windows.ahk
Last active September 18, 2023 18:20 — forked from chrisfcarroll/AutoHotKey for a Mac User with PC keyboard on Windows.ahk
AutoHotKey script for they who, being Mac Users with an Apple keyboard, yet still insist on using Windows. Also some arrange-windows-on-a-big-screen keys . Takes a similar approach as Parallels to keyboard mapping: rather than a wholesale swap of Cmd <-> Ctrl, instead duplicate favourite ctrl-key shortcuts to the Cmd key. For the big screen: som…
#InstallKeybdHook
; Language: English
; https://gist.github.com/chrisfcarroll/dddf32fea1f29e75f564
;
; Uses unicode. Save this file as utf-8 with BOM.
; Else it shall not work.
;
#NoEnv ; Recommended
;SendMode Input ; Recommended
@dgrebb
dgrebb / video-playback-onscroll.js
Created June 15, 2017 15:19
viewport scroll in/out event
/**
* Play or pause video based on visibility in window viewport.
*
* @param {any} video The video element.
*
* @memberof TabbedVideo
*/
toggleVideoPlayback(video) {
var windowHeight = window.innerHeight,