Instantly share code, notes, and snippets.


This is a workaround for Twitter search API being limited to only tweets from the past week.

Open Twitter on your favourite browser, open dev-tools, then go to console.

Make sure you are on Twitter search page, searching for your mentioned handle or hashtag or whatever.

Enter the code, it will only capture the handles but you can alter it to capture more data of your choosing.

It will attempt to adjust the page scroll to reach the bottom, in order to load more tweets, until you reach the end.

View chrono.js
var start = +new Date, d, chrono
d = new Date( +new Date - start )
chrono = (''+d).match( /\d+:\d+(?= )/g )[0] + ':' + Math.floor(d.getMilliseconds()/100)
document.body.innerHTML = chrono.replace(/(\d+)/g, '<span>$1</span>').replace(':', '\'').replace(':', '"')
}, 100)
View php-send-email-mailchimp-yt.php
require __DIR__ . '/vendor/autoload.php';
use \DrewM\MailChimp\MailChimp;
$mc = new MailChimp('<your-mailchimp-api-key>');
$list_id = 'fb05b906b8'; // list ID
$email_address = ''; // where to send
View Link.js
View mc-feed.php
Plugin Name: Tweak MailChimp Feeds RSS
Plugin URI:
Description: Tweak MailChimp RSS Feeds to add the featured image, excerpt and a read more button.
Author: Samuel Elh
Version: 0.1
Author URI:
import json
import urllib
downloader = urllib.URLopener()
# start by getting the full list of videos
with open('items.json') as json_data:
items = json.load(json_data)
# where to save the videos (directory)
save_to_dir = './'
View api.php
use Predis\Client as PredisClient;
include __DIR__ . '/vendor/autoload.php';
function redis() {
global $Redis;
if ( !isset($Redis) || !$Redis instanceof PredisClient ) {
View attachDomEvent.js
'use strict';
Object.prototype.attachDomEvent = function(eventName, callback)
eventName = eventName.replace(/^on/g, '');
if ( window.addEventListener ) {
this.addEventListener(eventName, callback, false);
} else if ( window.attachEvent ) {
#!/usr/bin/env python
import urllib, sys, re
xml = urllib.urlopen(''%sys.argv[1]).read()
try: rank = int('<POPULARITY[^>]*TEXT="(\d+)"', xml).groups()[0])
except: rank = -1
print 'Your rank for %s is %d!\n' % (sys.argv[1], rank)
View geoiplookup.php
* Get the user country code with package
* Requires geoiplookup package installed
* @link
* @param $ip user IP string
* @param $args Array (optional parameters)