Skip to content

Instantly share code, notes, and snippets.

View vjk2005's full-sized avatar

Vijay vjk2005

View GitHub Profile
@vjk2005
vjk2005 / ajax_page_loader.js
Created August 12, 2012 12:53
Load any number of pages via AJAX.
/*
DeepLoad:
Fetch any number of pages via AJAX for infinite scroll-like functionality.
First visit the site you want and put this into your browser console.
ToDo:
0. Determing page structure (where in the url should the page numbers need to be plugged in) from pages where the url doesn't have page structure yet (eg: homepage)
1. User can customize by passing arguments to the "get" function
2. resume a broken DeepLoad. Find if DOM has been modified by a previous DeepLoad run and start resuming from where the previous run left off
3. remove jquery dependency
@vjk2005
vjk2005 / deepload.js
Created October 1, 2012 16:27
Deep Load
/*
DeepLoad:
Fetch any number of pages via AJAX for infinite scroll-like functionality.
First visit the site you want and put this into your browser console.
ToDo:
2. resume a broken DeepLoad. Find if DOM has been modified by a previous DeepLoad run and start resuming from where the previous run left off
3. remove jquery dependency
4. convert it into a bookmarklet
5. make a youtube video tutorial and spread word about DeepLoad around
@vjk2005
vjk2005 / download500px.js
Last active December 12, 2016 13:39
Download images from 500px
// Bookmarklet
javascript:(function() {
var a = document.createElement('a'), img_src = document.getElementsByClassName( 'the_photo' )[0].src;
a.href = img_src;
a.download = document.getElementsByClassName('name')[0].innerText + ' by ' + document.getElementsByClassName('author_name')[0].innerText + '.' + img_src.split('.').pop();
document.body.appendChild(a);
a.click();
})();
@vjk2005
vjk2005 / tweetlog.js
Created December 12, 2012 09:46
Get user's tweets from anywhere ( cross-domain )
var s = document.createElement( 'script' );
s.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js';
document.body.appendChild( s ); // load jQuery
var
screen_name = "qtbrowneyes"
, this_many_tweets = 40;
function getTweets( screen_name, this_many_tweets ) {
$.getJSON( 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=' + screen_name + '&callback=?&count=' + this_many_tweets + '',
@vjk2005
vjk2005 / node-dropbox.js
Last active August 21, 2017 03:39
Simple HOW-TO tutorial on talking to Dropbox with Node.js
/*
Simple tutorial on talking to the Dropbox API using Node.js and MongoDB.
This is an educational exercise aimed to help you get up and running on localhost, but the production code,
though not that different from what's below, will make an extra effort to handle edge cases like if the user
denies us access to their Dropbox.
Code tested on Windows 8 (32-bit)
@vjk2005
vjk2005 / download_flickr_large.js
Created March 14, 2013 06:27
Download full-size photos from Flickr
javascript:window.location.href = document.getElementById( 'allsizes-photo' ).children[1].src
@vjk2005
vjk2005 / g-h.js
Created April 28, 2013 21:28
g.e-h.org loader
var s = document.createElement( 'script' )
s.src = 'http://code.jquery.com/jquery-1.8.0.min.js'
document.body.appendChild( s ) // load jQuery
var current=6, target = 150;
function load( url ) {
$.get( url, function( data ) {
$( '#i4' ).before( $( '#i3', data ).html() )
current++
@vjk2005
vjk2005 / blank_template.html
Created July 26, 2013 04:56
Blank HTML template with Jquery included.
<html>
<head>
<style type="text/css">
body { font-family: sans-serif; font-size: 13px; }
</style>
</head>
<body>
<div id="container">
<div id="content">
@vjk2005
vjk2005 / Find total file-size by type in linux
Created September 6, 2014 05:36
Example shows the use case for listing the total file size of all MP4 files in the current directory without any recursion. Use find command for recursion.
ls *.mp4 -l | awk '{total += $5} END {print total}'
@vjk2005
vjk2005 / Downloader Bookmarks
Last active August 29, 2015 14:07
Downloader Bookmarks
// iStock ▽
javascript:(function() {var a = document.createElement('a'), img_src = document.getElementById('s3img').children[0].src; a.href = img_src; a.download = img_src.split('/').pop(); document.body.appendChild(a); a.click();})();
// 500px ▽
javascript:(function() { var a = document.createElement('a'), img_src = document.getElementsByClassName('the_photo')[0].src; a.href = img_src; a.download = document.getElementsByClassName('name')[0].innerText + ' by ' + document.getElementsByClassName('author_name')[0].innerText + '.' + img_src.split('.').pop(); document.body.appendChild(a); a.click();})();
// Pinterest ▽
javascript:(function() { var a = document.createElement('a'), img_src = document.getElementsByClassName('pinImage')[0].src; a.href = img_src; a.download = document.getElementsByClassName('commentDescriptionContent')[0].innerText + '.' + img_src.split('.').pop(); document.body.appendChild(a); a.click();})();