Skip to content

Instantly share code, notes, and snippets.

View abraham's full-sized avatar
thanks a latte

Abraham Williams abraham

thanks a latte
View GitHub Profile
@abraham
abraham / example.json
Created July 7, 2018 23:25
Split a large JSON file into multiple files
[
{"one":"two"},
{"three":"four"}
]
@abraham
abraham / find.html
Created October 10, 2010 03:26
Add social media share links to your Blogger blog
<!-- Place share links here -->
<div class='post-header'>
@abraham
abraham / readme.md
Created November 3, 2022 22:06
Public test gist

hello world

import { one, two, pipe } from './utils';
class Main {
public sentence() {
return pipe<string>('word',
addPeriod,
capitalize);
}
}
@abraham
abraham / enable-print-styles.js
Created September 5, 2018 20:05
Enable CSS that is behind a `@media print` media query
Object.keys(document.styleSheets).forEach(function(styleSheetKey) {
var rules = document.styleSheets[styleSheetKey].rules || {};
Object.keys(rules).forEach(function(ruleKey) {
var media = rules[ruleKey].media;
if (media) {
media.mediaText = media.mediaText.replace('print', 'screen');
}
});
});
@abraham
abraham / bridgecode.php
Created September 10, 2010 05:51
Example code for getting an OAuth 1.0a access_token from Twitter @anywhere users.
<?php
// Download TwitterOAuth from http://github.com/abraham/twitteroauth.
require_once('twitteroauth/twitteroauth.php');
// Get consumer keys from http://dev.twitter.com/apps.
$consumer_key = '';
$consumer_secret = '';
$oauth_bridge_code = '';
CREATE TABLE `user` (
`twitter_id` int(10) unsigned NOT NULL,
`name` varchar(140) NOT NULL,
`screen_name` varchar(30) NOT NULL,
`location` varchar(180) default NULL,
`description` varchar(300) default NULL,
`profile_image_url` varchar(400) NOT NULL,
`url` varchar(400) default NULL,
`protected` varchar(5) default NULL,
`followers_count` int(10) unsigned NOT NULL,
@abraham
abraham / followers.php
Created September 26, 2010 21:53
Quick script to get all of the followers for Twitter users.
<?php
// Require the TwitterOAuth library. http://github.com/abraham/twitteroauth
require_once('twitteroauth/twitteroauth.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET);
// Empty array that will be used to store followers.
$profiles = array();
// Get the ids of all followers.
$ids = $connection->get('followers/ids');
// Chunk the ids in to arrays of 100.
@abraham
abraham / facebook.py
Created August 14, 2010 08:45
Finds who among your Facebook friends you have the most common interests and likes with
#!/usr/bin/python -tt
# MIT licensed by Abraham Williams - http://abrah.am
# Pulls your Facebook friends likes and interest and finds who you have the most in common with.
import urllib, json, sys
graph_url = 'https://graph.facebook.com/'
def print_intersect_count(access_token):
tally = {}