Skip to content

Instantly share code, notes, and snippets.

View adaptive's full-sized avatar
🎯
Focusing

Hugo Romano adaptive

🎯
Focusing
View GitHub Profile
@adaptive
adaptive / enablegooglewebhistory.user.js
Created August 24, 2008 14:16
Enable Google Web History without Google Toolbar
// ==UserScript==
// @name EnableGoogleWebHistory
// @author mallowlabs
// @namespace http://mallowlabs.s206.xrea.com/
// @version 0.0.2
// @license public domain
// @description : Enable Google Web History
// @published 2007-01-05
// @modified 2006-01-05
// @include *
(function($){
/* hoverIntent by Brian Cherne */
$.fn.hoverIntent = function(f,g) {
// default configuration options
var cfg = {
sensitivity: 7,
interval: 100,
timeout: 0
};
// override configuration options with user supplied object
<script type="text/javascript" language="javascript">
// <![CDATA[
Effect.divSwap = function(element,container){
var div = document.getElementById(container);
var nodeList = div.childNodes;
var queue = Effect.Queues.get('menuScope');
if(queue.toArray().length<1){
if(Element.visible(element)==false){
for(i=0;i<nodeList.length;i++){
if(nodeList.item(i).nodeName=="DIV" && nodeList.item(i).id!=element){
<?php
if(! class_exists('MemCache', false))
{
class MemCache
{
//Add an item to the server
function add ( $key , $var , $flag = null , $expire =null )
{
return FALSE;
// place your text within the variable $text
// use this code to extract email addresses from a text
$text = ' email@domain.com ';
function parseTextForEmail($text) {
$email = array();
$invalid_email = array();
$text = ereg_replace("[^A-Za-z._0-9@ ]"," ",$text);
<?php
###############################################################
# Email Extractor 1.0
###############################################################
# Visit http://www.zubrag.com/scripts/ for updates
###############################################################
$the_url = isset($_REQUEST['url']) ? htmlspecialchars($_REQUEST['url']) : '';
<?php
/**
* Class Gravatar
*
* From Gravatar Help:
* "A gravatar is a dynamic image resource that is requested from our server. The request
* URL is presented here, broken into its segments."
* Source:
* http://site.gravatar.com/site/implement
Simple GD examples:
Resize an image
<?php
// Set the path to the image to resize
$input_image = "House.jpg";
// Get the size of the original image into an array
$size = getimagesize( $input_image );
// Set the new width of the image
@adaptive
adaptive / gist:14936
Created October 5, 2008 21:17
generating hashes in php (SHA-256, SHA-512)
<?php
// SHA-256, SHA-512
$var = 'lorem ipsum';
$hash256=hash('sha256', $var);
$hash512=hash('sha512', $var);
echo $hash256 $hash512;
?>
<?php
header('content-type: image/jpeg');
$watermark = imagecreatefrompng('watermark.png');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
$image = imagecreatetruecolor($watermark_width, $watermark_height);
$image = imagecreatefromjpeg($_GET['src']);
$size = getimagesize($_GET['src']);