Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony DeCrescenzo rgbink

View GitHub Profile
@rgbink
rgbink / phone-regex.js
Created Mar 23, 2017
Fairly robust phone validation regex
View phone-regex.js
// basic US, no country code
((\(*\d{3}\)* *?)|(\d{3}[ -\.]*))?\d{3}[ -\.]*\d{4}
// leading country codes and optional repeat separators
^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. \/)]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$
@rgbink
rgbink / tab-close-chrome.scpt
Last active Feb 2, 2017
Applescript to Close particular tab(s) in Google Chrome
View tab-close-chrome.scpt
tell application "Google Chrome"
-- edit the following url to be as specific or generic as you wish
-- in my functioning script I've added the particular spreadsheet that I wish to close
set windowList to every tab of every window whose URL starts with "https://docs.google.com/spreadsheets/"
repeat with tabList in windowList
set tabList to tabList as any
repeat with tabItr in tabList
set tabItr to tabItr as any
delete tabItr
end repeat
@rgbink
rgbink / MyFitnessPal_AutoFocus_quantity_food_entry_editing.js
Last active May 17, 2016
MyFitnessPal UserScript to AutoFocus on quantity when editing a food entry
View MyFitnessPal_AutoFocus_quantity_food_entry_editing.js
// ==UserScript==
// @name MyFitnessPal Input Focus
// @namespace http://www.rgbink.com/
// @version 0.1
// @author Anthony DeCrescenzo
// @match http*://www.myfitnesspal.com/food/diary*
// @grant none
// @description A script to automatically focus on the quantity input field when editing a food entry. So, if you click to edit a food item, when the popup appears the quantity will be highlighted, ready to be replaced/typed over.
// ==/UserScript==
@rgbink
rgbink / git_overwrite_branch
Created Jun 4, 2015
Completely Overwrite chosen git branch
View git_overwrite_branch
git checkout desired_branch // put in the name of the branch you wish to KEEP
git merge -s ours branch_to_be_replaced // put in the name of the branch you want to OVERWRITE
git checkout branch_to_be_replaced // put in the name of the branch you want to OVERWRITE
git merge desired_branch // put in the name of the branch you wish to KEEP
View dropbox-sync-script.sh
#!/bin/bash
# h/t Roger Chen, http://code.rogerhub.com/terminal-fu/53/backing-up-dropbox-with-rsync/
DIR=$HOME/Dropbox
read -p "The target directory is: $DIR. Correct? [yn] " -n 1
if [[ $REPLY =~ ^[Yy]$ ]];then
if [ -d $DIR ];then
echo -e "\n"
rsync -vauzh --progress --exclude '.dropbox*' --delete $DIR home:~/backup/dropbox
@rgbink
rgbink / Bootstrap 3 Media Breakpoints [standard].css
Last active Aug 29, 2015
Bootstrap 3 Media Breakpoints [standard]
View Bootstrap 3 Media Breakpoints [standard].css
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
View [jQuery] Set columns to equal heights.js
$(document).ready(function() {
$.fn.setAllToMaxHeight = function() {
return this.height(Math.max.apply(this, $.map(this, function(e) {
return $(e).height();
})));
};
$(window).load(function() {
View stash_nested_embeds.md

Required:

Stash 2.3.4 (beta) or later

Stash template directory

	/layouts/
		standard.html

	/partials/
		listing.html
View low-search-ajax.js
(function($){
$(function(){
var $form = $('#search'), // Search form
$target = $('#results'), // Results container
rp = 'search/ajax-results'; // Template for results only
// Function to execute on success
var success = function(data, status, xhr) {
$target.html(data);
};
View 1) readme.md

How to set up Gulp with an ExpressionEngine project

I freaking love working with technologies like Grunt and Gulp, and wanted to share how to get my current EE front-end workflow set up. With a few tweaks, this can also be used with virtually any other sites (I've used it with Laravel, static sites, Craft, etc).

Install Node.js

  • If Node is not yet installed on the machine, it will need to be installed

Install Gulp (if needed)