This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from icalendar import Calendar, Event | |
import simplejson as json | |
import re | |
import web | |
from mimerender import mimerender | |
import sys | |
import urllib2 | |
event = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "Rh9", | |
"latitude": 45.524164, | |
"longitude": -122.67881 | |
}, | |
{ | |
"id": "Rha", | |
"latitude": 45.52431, | |
"longitude": -122.67722 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"places": [ | |
{ | |
"extra": { | |
"active": "1" | |
}, | |
"latitude": "45.525467", | |
"longitude": "-122.678533", | |
"name": "8th Ave North of Everett", | |
"place_id": "3k2", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read more: http://neverusethisfont.com/blog/2011/03/url-shortener-as-a-search-interface/ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/search?btnI=I\'m+Feeling+Lucky&q=' . urlencode($_GET['code']) . '+site%3Acyborganthropology.com'); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE); // Don't follow redirects, we want the first Location header | |
curl_setopt($ch, CURLOPT_HEADER, TRUE); // Return the headers in the output curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla"); // Set the user agent to Mozilla so Google doesn't block the query | |
curl_setopt($ch, CURLOPT_NOBODY, TRUE); // Don't include the response body in the output | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return the response in a variable instead of printing it out | |
$response = curl_exec($ch); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$examples[] = 'This is text with no trim components'; | |
$examples[] = 'This text is short but has /--trim components --/ too.'; | |
$examples[] = 'This text is going to be quite long and has some parts that can be removed, /--such as this one, --/ and some that can\'t.'; | |
$examples[] = 'This text is /-2-quite --/long and has some parts that can be removed, /-1-such as this one, --/ and some that can\'t.'; | |
$trimLength = 100; | |
foreach($examples as $example) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'socket' | |
socket = TCPSocket.new("stream.geoloqi.com", 40000) | |
puts socket.recv(100) | |
socket.write('your-access-token') | |
socket.flush | |
# The server outputs a confirmation message after connecting | |
puts socket.recv(1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id = $_GET['id']; | |
function getSignificantSentence($id) { | |
$url = 'http://en.wikipedia.org/w/index.php?curid=' . $id; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set up your database connection | |
define('PDO_DSN', 'mysql:dbname=test;host=127.0.0.1'); | |
define('PDO_USER', 'root'); | |
define('PDO_PASS', ''); | |
/****** | |
Output will be something like this: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Linode 1 -> itself over 127.0.0.1: | |
Finished in 5136 ms | |
avg connect: 564 microseconds | |
avg prepare: 71 microseconds | |
avg execute: 176 microseconds | |
avg fetch: 4 microseconds | |
---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Put this in a file called post.php --> | |
<?php | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'https://spreadsheets.google.com/formResponse?formkey=your-google-form-key'); | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( | |
'entry.0.single' => date('Y-m-d H:i:s'), | |
'entry.1.single' => $_POST['email'], | |
'entry.2.single' => $ref, |