Skip to content

Instantly share code, notes, and snippets.

View tuxracer's full-sized avatar

Derek Petersen tuxracer

View GitHub Profile
els = document.querySelectorAll('video,audio,embed,object,iframe');
for (var i = 0; i < els.length; i++) {
el = els[i];
el.parentNode.removeChild(el);
};
@tuxracer
tuxracer / gist:0353a6bc9edd3079f350
Created January 21, 2015 07:37
crashplan raspberry pi
ssh -f -L 4200:localhost:4243 pi@raspberrypi -N
ffmpeg -ss 00:00:00 -i movie-name.mp4 -s 480x234 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=8 > movie-name.gif
(function () {
var $ = window.jQuery;
if ($) {
$('body').find('div,header').each(function () {
var $el = $(this);
if ($el.css('position') === 'fixed' && $el.css('top') === '0px') {
$el.css('position', 'relative');
}
@tuxracer
tuxracer / curlz.js
Last active December 20, 2022 12:03
els = document.querySelectorAll('*');
for (var i = els.length - 1; i >= 0; i--) {
var font = "Curlz MT"
, el = els[i]
;
el.style.fontFamily = font;
};
@tuxracer
tuxracer / stop-timers.coffee
Created February 16, 2014 00:20
Stop timers on dispose of chaplin views, controllers, models, and collections
# Using @setTimeout or @setInterval will clear the timers on dispose
# Mixin, can be used with https://github.com/HubSpot/mixen
start = (type, args) ->
unless @disposed
method = window["set#{type}"]
timer = method.apply window, args
@timers[type].push timer
timer
(function() {
var path = "http://www.example.com/",
containerEl = document.createElement("div"),
frameEl = document.createElement("iframe"),
styleEl = document.createElement("link");
var sanitizePostMessage = function (e) {
if (e.origin === "http://www.example.com/") {
return false;
}
@tuxracer
tuxracer / whenTruthy.coffee
Last active January 4, 2016 18:09
Resolve this promise when key on an object is truthy Public domain
# Resolve this promise when key on an object is truthy
# Optionally you can pass a timeout when to give up and how frequently to check
# Returns a promise resolved or rejected with the value given
whenTruthy = (key, obj = mediator, timeout = 60000, frequency = 100) ->
dfd = new $.Deferred
if obj[key]
dfd.resolve obj[key]
else
giveUp = setTimeout ->
@tuxracer
tuxracer / gist:8120911
Created December 25, 2013 07:16
Create bootable linux disk with progress
pv -ptre ubuntu-13.10-desktop-amd64.img | sudo dd of=/dev/rdisk2 bs=1m
@tuxracer
tuxracer / gist:7666068
Created November 26, 2013 20:55
tag in gerrit
git checkout v2.0
git tag -am "Adding v2.0.1 tag" v2.0.1
git push origin v2.0.1 HEAD:refs/heads/v2.0