Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div></div>
</body>
</html>
@octopi
octopi / gist:8da1f7ecf764d3b1b641
Last active August 29, 2015 14:02
producthuntscraper
import urllib2
from bs4 import BeautifulSoup
m = 0
ph_home = BeautifulSoup(urllib2.urlopen('http://www.producthunt.com'))
cache = []
for thread in ph_home.findAll('a', { 'class': 'view-discussion' }):
thread_page = BeautifulSoup(urllib2.urlopen('http://producthunt.com' + thread['href']))
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>foursquare :: Explore Sample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript" id="jquery"></script>
@octopi
octopi / index.html
Created November 18, 2013 18:51
Sample Save-to-Foursquare Button
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Sample Foursquare Widget</title>
</head>
<body>
<h1>Sample Foursquare Widget</h1>
<!-- Place this anchor tag where you want the button to go -->
<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-variant="wide" data-vid="412d2800f964a520df0c1fe3">Save to foursquare</a>
@octopi
octopi / app.rb
Created June 1, 2013 01:37
The completed OAuth tutorial with missing parts filled in. Original: https://github.com/octopi/oauth_tutorial
include Mongo
mongo_uri = ENV['MONGOLAB_URI'] || 'mongodb://localhost:27017'
mongo = MongoClient.from_uri(mongo_uri)
db = mongo[mongo_uri[%r{/([^/\?]+)(\?|$)}, 1] || 'test']
get '/' do
# mongodb usage -- see README for proper db setup
logger.info(db['testCollection'].find({'foo' => 'meh'}).first)
@octopi
octopi / node-basic-4sq-request.js
Created March 7, 2013 16:44
A basic GET request to the Foursquare API in node.js To run, use `node node-basic-4sq-request.js` and point your browser to `http://localhost:8888`
var http = require('http'),
https = require('https');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
var options = {
host: 'api.foursquare.com',
path: '/v2/venues/explore?oauth_token=YOUR_OAUTH_TOKEN&near=10027&query=bars',
method: 'GET',