Skip to content

Instantly share code, notes, and snippets.

View kaitwalla's full-sized avatar

Kaitlyn Concilio kaitwalla

View GitHub Profile
@kaitwalla
kaitwalla / gist:5573648
Created May 14, 2013 04:16
Get parent url from iframe (JS)
var url = (window.location != window.parent.location) ? document.referrer: document.location;
display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;
@kaitwalla
kaitwalla / gist:10747012
Last active August 29, 2015 13:59
VideoJS dynamic load
function makeVid(vidSrc,width,height,poster,id,div) {
if (typeof vidSrc === 'undefined') {
console.log('You need to include a video source in order to call a video');
return false;
}
div = typeof div !== 'undefined' ? div : 'body';
width = typeof width !== 'undefined' ? width : 640;
height = typeof height !== 'undefined' ? height : 480;
poster = typeof poster !== 'undefined' ? poster : 'none';
id = typeof id !== 'undefined' ? id : 'player' ;
@kaitwalla
kaitwalla / gist:10747066
Created April 15, 2014 16:52
VideoJS — Stats tracking
_V_(document.getElementByID('player',{},function() {
var trackEvent = function() {
var videoID = this.id();
_gaq.push(['_trackEvent', 'VideoJS', event.type,videoID]);
}
this.on('play',trackEvent);
});
@kaitwalla
kaitwalla / gist:10747182
Last active August 29, 2015 13:59
VideoJS — Progress update tracking
_V_(document.getElementById('player'),{},function() {
var videoID = this.id();
window[videoID] = {};
window[videoID].pct = 1;
var trackEvent = function() {
var videoID = this.id();
_gaq.push(['_trackEvent', 'VideoJS', event.type,videoID]);
};
var trackTime = function() {
var videoID = this.id();
@kaitwalla
kaitwalla / gist:c2e2e4ad898c8fc27156
Last active August 29, 2015 14:01
Change EXIF data in PHP
require_once('/../pel/PelDataWindow.php');
require_once('/../pel/PelJpeg.php');
$filename = $_GET['file'];
// If your files are stored in a different directory, you'll want to add the directory structure here, before $filename
$file = $filename;
// This assumes you're using a form. Change the $caption as you'll need (if loop, etc.)
$caption = $_GET['caption'];
$pic = new PelJpeg($file);
@kaitwalla
kaitwalla / Emailer.gs
Created August 6, 2014 18:41
Google Apps Script to send an email from a server that does not have sendmail capabilities. Assumes you're grabbing the text of the email from an external URL as JSON, and including a photo as an attachment
// URL to send looks like scriptcontent.google.com/etc/?key=KEY&photo=PHOTO_URL&to=EMAIL_ADDR&subj=SUBJECT&body=URl_FOR_TEXT
function doGet(request) {
//requiring a key adds security so not just anyone can send mail
if (request.parameters.key == 'KEY') {
// Get caption from system, make it the body of the email
var body = UrlFetchApp.fetch(request.parameters.body);
//You can lose this if you're not grabbing JSON
var content = JSON.parse(body);
// Use "___LB___" in the text to indicate where you want line breaks to be, {B}where you want things bolded{/B}
@kaitwalla
kaitwalla / dequeue
Created September 11, 2014 19:09
Dequeuer for push in Javascript
function dequeue(data) {
if (temp) {
queue.push(data);
var time = temp.getTimeLeft();
temp.stop();
temp = new timer(function () {
temp = false;
dequeue();
},time);
}
@kaitwalla
kaitwalla / datatables.modal
Created October 15, 2014 14:17
DataTables show all fields (including hidden) using jQuery Modal
$('#dtable tbody').on('click','tr',function() {
$(this).addClass('selected');
row = dTable.row('.selected').data();
$('#201314YorkAdamsTeacherSalaries1411419301 .modal table').html('');
for (var i = 0; i < cols.length; i++) {
$('<tr><td><strong>'+cols[i]+'</strong></td><td>'+row[i]+'</td></tr>').appendTo('#201314YorkAdamsTeacherSalaries1411419301 .modal table');
}
$('#201314YorkAdamsTeacherSalaries1411419301 .modal').modal().on($.modal.BEFORE_CLOSE,function() {
$('#201314YorkAdamsTeacherSalaries1411419301 tr.selected').removeClass('selected');
});
@kaitwalla
kaitwalla / Readme.md
Last active September 10, 2021 20:36
Make Vagrant Great Again, or: Down Is the Frigging Antonym of Up, and Other Useful Things.

Better Vagrant Commmands

The purpose of this shell command is to make the vagrant commands

  1. slightly easier to use if you're not already in the Vagrant directory
  2. parallel

(Not gonna lie, 2 was actually the bigger motivator. Can't tell you how many times I typed vagrant down to have nothing happen.)

The file is structured a little oddly because it's actually part of another, larger command used for deployments and the like. If there are any bugs, let me know, as I probably didn't parse it out very carefully.