Skip to content

Instantly share code, notes, and snippets.

View raddevon's full-sized avatar

Devon Campbell raddevon

View GitHub Profile
@raddevon
raddevon / gist:67935d320ee9b726d19d
Created January 17, 2016 16:55
Adobe tries to strong-arm me into keeping Creative Cloud
Chaitra: Hello! Welcome to Adobe Customer Service.
Me: Hello
Chaitra: Hi Devon
Chaitra: I understand that you wish to cancel your subscription, let me help you with that.
Chaitra: May I know the reason for cancellation please?
Me: I'm not using the software enough to justify the cost.
Chaitra: Thank you for the information.
Me: No problem!
Chaitra: I have checked and see that you have Creative Cloud membership (one-year) subscription, which was purchased on 18 Jun 2013.
Chaitra: Before you decide to cancel your subscription, let me give you an offer.
@raddevon
raddevon / openAnchorAccordion.js
Last active April 1, 2020 19:50
Open a Bootstrap accordion control if its anchor is target on page load
// Opens accordion automatically if an accordion target is accessed from another page
// Assumes the accordion-group is the target linked to
function openAnchorAccordion() {
if (window.location.hash) {
var $target = $('body').find(window.location.hash);
if ($target.hasClass('accordion-group')) {
var $targetAccordion = $target.find('.collapse');
$targetAccordion.collapse('show');
}
}
@raddevon
raddevon / anchorScrollOffset.js
Last active July 15, 2016 19:23
Anchor target fix for fixed navbar. Based on http://stackoverflow.com/a/13067009/800492 but with additions to avoid colliding with Bootstrap's JS widgets.
// Creates an attribute pseudo-selector allowing for wildcards
jQuery.expr.pseudos.attr = $.expr.createPseudo(function(arg) {
var regexp = new RegExp(arg);
return function(elem) {
for(var i = 0; i < elem.attributes.length; i++) {
var attr = elem.attributes[i];
if(regexp.test(attr.name)) {
return true;
}
}
@raddevon
raddevon / gist:6424026
Created September 3, 2013 13:36
Makes a new directory and changes to it
function mcd() {
mkdir "$@" && cd "$@"
}
RECEIPT_FILE=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom
RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
if [ ! -f "$RECEIPT_FILE" ]
then
echo "Command Line Tools not installed."
exit 1
fi
echo "Command Line Tools installed, removing ..."
@raddevon
raddevon / headline_script.rb
Created June 26, 2013 23:29
Ruby script to flesh out the OnionOrNot headlines JSON file
require 'net/http'
require 'uri'
require 'xmlsimple'
require 'json'
require 'pry'
def get_rss(url)
# Fetches an RSS feed from the URL
# Returns it as a Ruby object
uri = URI.parse(url)
@raddevon
raddevon / Gruntfile.js
Created June 21, 2013 15:21
Gruntfile for my personal site
var scripts = ['js/jquery-1.9.1.js', 'js/jquery.animate-enhanced.min.js','jquery.easing.min.js', 'js/**/*.js', '!js/scripts.js'];
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
@raddevon
raddevon / gist:5815372
Created June 19, 2013 15:47
Smooth scrolling anchor links with jQuery. This script was taken from http://www.paulund.co.uk/smooth-scroll-to-internal-links-with-jquery . I modified it to fix a bug when using it with anchor links pointing to the top of the page ('#').
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': ($target.offset()) ? $target.offset().top : 0
}, 400, 'ease', function () { // Set the duration and easing function as desired.
window.location.hash = target;
});
});
@raddevon
raddevon / GAE Deploy.sublime-build
Created June 12, 2013 14:44
Google App Engine deployment build system for Sublime Text
{
"cmd": ["appcfg.py", "update", "$project_path"]
}