Skip to content

Instantly share code, notes, and snippets.

Justin Gitlin cacheflowe

Block or report user

Report or block cacheflowe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cacheflowe
cacheflowe / remove-twitter-likes.js
Last active Mar 5, 2020
Remove your Twitter likes
View remove-twitter-likes.js
// go to your account Likes page and run this in the console:
function scrollToLoadMore() {
// keep scrolling if twitter tries to stop loading more.
// scroll up, then down to force infinite load.
window.scrollTo(0, 0);
setTimeout(function() {
window.scrollBy(0, 9999999999);
}, 200);
}
@cacheflowe
cacheflowe / render-svg.js
Last active Nov 27, 2016
Render svg to bitmap
View render-svg.js
var renderSVG = function(svgEl, renderedCallback, jpgQuality) {
// WARNING! Inline <image> tags must have a base64-encoded image as their source. Linked image files will not work.
// transform svg into base64 image
var s = new XMLSerializer().serializeToString(svgEl);
var uri = 'data:image/svg+xml;base64,' + window.btoa(s);
// load svg image into canvas
var image = new Image();
image.onload = function() {
var canvas = document.createElement('canvas');
@cacheflowe
cacheflowe / gist:323a74aad892542fdd9d
Created Feb 28, 2016
Download all .jpg attachments in an expanded gmail thread
View gist:323a74aad892542fdd9d
var els = document.querySelectorAll('span[download_url]')
for(var i=0; i < els.length; i++){
(function(){
var attr = els[i].getAttribute('download_url');
if(attr.indexOf('jpg:https') != -1){
var url = 'https' + attr.split('jpg:https')[1];
setTimeout(function(){
document.location.href = url;
}, i * 1000)
}
@cacheflowe
cacheflowe / gist:7668084
Last active Dec 29, 2015
Show/hide sass/css toggle w/fade
View gist:7668084
.hide
opacity: 0
visibility: hidden
// to be added to .hide after init
.hide-ready
transition: visibility 0s linear 0.4s, opacity 0.4s linear
-webkit-transition: visibility 0s linear 0.4s, opacity 0.4s linear
.hide-ready.showing
@cacheflowe
cacheflowe / gist:7547942
Created Nov 19, 2013
CoffeeScript: Confine form input tabbing to a group of inputs
View gist:7547942
disableForms: (page) ->
@formInputs = page.$el.find('input[tabindex], textarea[tabindex]')
@formInputs.off 'keydown', @handleTab
@formInputs.blur()
enableForms: (page) ->
@formInputs = page.$el.find('input[tabindex], textarea[tabindex]')
@formInputs.on 'keydown', @handleTab
handleTab: (e) =>
View Obj-C snippets for sanity and profit
// check existence of a local file within an app bundle -------------------------------------
NSString *soundFile = @"sound.wav";
NSFileManager* manager;
manager = [NSFileManager defaultManager];
if([manager fileExistsAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:soundFile]])
printf("file Exists...\n\n");
else
printf("File not exist...\n\n");
@cacheflowe
cacheflowe / Unix & Shell Commands
Last active Dec 24, 2018
Sweet Unix commands
View Unix & Shell Commands
# file copying & filesystem stuff ##############################
# copy massive directories
sudo cp -R -n -p /Volumes/RAID01/_backup_laptop /Volumes/RAID2TB/machine_backups/
# or use rsync
sudo rsync -rltgoDv /Volumes/RAID02/ /Volumes/RAID06/
# diff directories
diff -rq /Volumes/RAID01/_backup_laptop /Volumes/RAID2TB/machine_backups/_backup_laptop/
@cacheflowe
cacheflowe / SASS: Retina image media query mixin
Last active Oct 5, 2015
Media queries to load only 1 image per browser width / pixel density
View SASS: Retina image media query mixin
// webkit-only .sass --------------------------------
@media (min-width: 20px) and (max-width: 480px) and (-webkit-min-device-pixel-ratio: 1.5)
#site-loader-inner
background: transparent url('mobile/loaders/loader-spin@2x.png', image)
@media (min-width: 20px) and (max-width: 480px) and (-webkit-max-device-pixel-ratio: 1.5)
#site-loader-inner
background: transparent url('mobile/loaders/loader-spin.png', image)
You can’t perform that action at this time.