Skip to content

Instantly share code, notes, and snippets.

View peter279k's full-sized avatar
🎯
Focusing

Chun-Sheng, Li peter279k

🎯
Focusing
View GitHub Profile
@pingyen
pingyen / plurkBot.php
Last active October 20, 2018 22:14
Plurk Bot
<?php
define('NICKNAME', 'abc');
define('PASSWORD', 'iamabc');
define('USER_ID', '123456');
$message = 'Hello World!';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
/* MODELS */
var ProjectCollection = function(projects){
var self = this;
var projects = projects;
this.create = function(attrs){
projects.push(attrs)
// might want to a bit of ajax here
@nesquena
nesquena / Uniform Setup.md
Created August 3, 2010 22:30
Uniform Server Setup

Enable universe repository:

# /etc/apt/sources.list

## main & restricted repositories
deb http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted universe
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted universe

deb http://security.ubuntu.com/ubuntu jaunty-security main restricted universe

deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted universe

@dahnielson
dahnielson / UUID.php
Last active April 5, 2024 21:14
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@njh
njh / redland_parse.php
Created October 17, 2010 16:34
Parse RDF/XML to RDF/PHP using the redland PHP extension
<?php
$URL = 'http://dbpedia.org/resource/London.rdf';
$DATA = file_get_contents('london.rdf');
$FORMAT = "rdfxml";
if (!extension_loaded('redland')) {
throw new Exception("redland extension is not loaded");
}
@vyatri
vyatri / MimeMailParser.class.php
Created April 24, 2011 09:06
This class allows you to receive and parse email in PHP efficiently and effortlessly.
<?php
require_once('attachment.class.php');
/**
* Fast Mime Mail parser Class using PHP's MailParse Extension
* @author gabe@fijiwebdesign.com
* @url http://www.fijiwebdesign.com/
* @license http://creativecommons.org/licenses/by-sa/3.0/us/
* @version $Id$
@bdunogier
bdunogier / curl_progress.php
Created June 16, 2011 22:31
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@baijum
baijum / selenium_with_python.rst
Last active April 19, 2024 14:37
Selenium with Python
@ethangardner
ethangardner / php-gzip-optimization.php
Created June 29, 2011 00:25
PHP Gzip Optimization
<?php
if(extension_loaded('zlib')){
ob_start('ob_gzhandler');
}
header ('content-type: text/css; charset: UTF-8');
header ('cache-control: must-revalidate');
$offset = 60 * 60;
$expire = 'expires: ' . gmdate ('D, d M Y H:i:s', time() + $offset) . ' GMT';
header ($expire);
ob_start('compress');
@zester
zester / main.cpp
Created August 29, 2011 03:46
Skia Graphics Library Example (Note: Use to work)
#include "SkCanvas.h"
#include "SkGraphics.h"
#include "SkImageEncoder.h"
#include "SkString.h"
#include "SkTemplates.h"
int main (int argc, char * const argv[]) {
//
SkAutoGraphics ag;