Skip to content

Instantly share code, notes, and snippets.

<?php
global $wpdb;
define('WP_USE_THEMES', false);
require_once('../../../wp-load.php' );
require_once('../../../wp-admin/includes/file.php' );
$wp->init();
@beweinreich
beweinreich / Ruby Web Client
Created July 17, 2012 14:08
Running a ruby web client using mysql
#!/usr/bin/ruby
require 'rubygems'
require 'socket'
require 'mysql2' # gem install mysql2
webserver = TCPServer.new('127.0.0.1', 6789)
client = Mysql2::Client.new(
:host => "127.0.0.1",
:username => "root",
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
@beweinreich
beweinreich / Twitter PHP Parser
Created August 1, 2012 17:16
Twitter Parser
<?
$username = "roundedco";
$limit = 5;
$feed = 'http://twitter.com/statuses/user_timeline.rss?screen_name='.$username.'&count='.$limit;
$tweets = file_get_contents($feed);
$tweet = explode("<item>", $tweets);
$tcount = count($tweet) - 1;
for ($i = 1; $i <= $tcount; $i++) {
$endtweet = explode("</item>", $tweet[$i]);
@beweinreich
beweinreich / binstagram.php
Created January 3, 2013 18:27
Wordpress Plugin that allows for easy Instagram integration
<?php
/*
Plugin Name: Instagram Integration
Plugin URI: http://roundedco.com
Description: Allows admin to manage instagram integration
Author: Brian Weinreich
Version: 1.0
Author URI: http://www.roundedco.com
*/
from plaid import Client
from plaid import errors as plaid_errors
# import DRF, env vars, etc.
Client.config({'url': settings.PLAID_CONFIG_URL})
plaid_client = Client(client_id=settings.PLAID_CLIENT_ID, secret=settings.PLAID_SECRET)
public_token = "test,chase,connected"
account_id = "someaccountid"
try:
response = plaid_client.exchange_token(public_token, account_id)

Keybase proof

I hereby claim:

  • I am beweinreich on github.
  • I am beweinreich (https://keybase.io/beweinreich) on keybase.
  • I have a public key whose fingerprint is 5301 41B7 F30F 87DB CC11 CA79 5086 178A D857 6C67

To claim this, I am signing this object:

<?
$request_url = "SOME-URL-THAT-HAS-XML";
$xml = simplexml_load_file($request_url) or die("feed not loading");
foreach($xml->entry as $entry) {
$id = $entry->id;
$author = $entry->author;
$title = $entry->title;
$content = $entry->content;
@beweinreich
beweinreich / facebook_fanpage_parser.php
Created January 8, 2013 21:30
A Facebook fanpage feed parser built in PHP.
<?php
// Facebook Fanpage Parser
// Author: Brian Weinreich
// Company: Rounded
// Website: http://roundedco.com
// Make sure you read through this documentation before implementing!
// Head to https://developers.facebook.com/apps and create a new app
// Log in under Rounded Developments Facebook account (Ask Brian for creds if you don't know them)
import requests
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer REPLACE_ME'}
url = 'https://api.density.io/v2/spaces'
response = requests.get(url, headers=headers)
json_data = response.json()
for result in json_data['results']:
print('{name}: {current_count}\n').format(name=result['name'], current_count=result['current_count'])