Skip to content

Instantly share code, notes, and snippets.

@Lusitanian
Lusitanian / CreatingAService.php
Last active Dec 12, 2015
Creating a Twitter OAuth1 Service
View CreatingAService.php
<?php
use OAuth\ServiceFactory;
use OAuth\Common\Storage\Session;
use OAuth\Common\Consumer\Credentials;
// create a factory
// optional constructor argument defines the type of http client to use for the services this factory creates
$factory = new ServiceFactory();
// tokenstorageinterface implementation
@Lusitanian
Lusitanian / JSONRoutingTableDumper.cpp
Created Feb 5, 2013
Windows routing table dumper
View JSONRoutingTableDumper.cpp
#include <iostream>
#include <string>
#include <sstream>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#pragma comment(lib, "iphlpapi.lib")
#pragma comment(lib, "ws2_32.lib")
int main()
View ClientSideSessionHandler.php
<?php
class ClientSideSessionHandler implements SessionHandlerInterface
{
const SESSION_COOKIE_NAME = 'data';
private $cryptor;
private $cookieJar;
private $encryptionKey;
private $signingKey;
@Lusitanian
Lusitanian / OverlapCalculator.php
Created Aug 24, 2012
Time Interval Overlap Calculator
View OverlapCalculator.php
<?php
/**
* Calculates the amount of overlap between a source time range and a variable number of compared time ranges.
* Implements a subset of Allen's Interval Algebra.
* With contributions by rdlowery.
*/
class OverlapCalculator {
/**
* @var int
You can’t perform that action at this time.