Skip to content

Instantly share code, notes, and snippets.

@basvandorst
basvandorst / webm-vimeo-fallback.html
Created November 27, 2011 19:24 — forked from vasilisvg/webm-vimeo-fallback.php
WebM fallback for Vimeo with jQuery
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var video = document.createElement("video");
@basvandorst
basvandorst / Google-shortener.php
Created December 12, 2011 18:59
PHP class for the Google URL shortener API
<?php
if (!function_exists('curl_init'))
trigger_error('CURL is not installed');
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@basvandorst
basvandorst / Google-showtime.php
Created December 12, 2011 19:00
PHP Google showtime grabber
<?php
/**
* Google Showtime grabber
*
* This file will grab the last showtimes of theatres nearby your zipcode.
* Please make the URL your own! You can also add parameters to this URL:
* &date=0|1|2|3 => today|1 day|2 days|etc..
*
* Please download the latest version of simple_html_dom.php on sourceForge:
* http://sourceforge.net/projects/simplehtmldom/files/
@basvandorst
basvandorst / Greplin-palindrome.php
Created December 12, 2011 19:02
PHP: Find longest palindrome
<?php
/**
* Easy way to find the longest palindrome in a string
*
* Solution for: http://challenge.greplin.com/
* The Greplin Programming Challenge: Version 1
*
* @author Bas van Dorst <[email protected]>
*/
$data = "FourscoreracecarsthatandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheyw
@basvandorst
basvandorst / mdn-logo-html5-css3.html
Created December 12, 2011 19:06
HTML5/CSS3: Mozilla Developer Network logo
<html>
<head>
<style type="text/css">
#container {
position:relative;
border: solid 12px #181918;
@basvandorst
basvandorst / clickable.js
Created December 19, 2011 17:57
jQuery, make the whole li/div clickable, with target new window. Use the first a-href for the link
$('.clickable')
.has('a')
.css('cursor', 'pointer')
.bind('click',function() {
var href = $('a', this).attr('href')
if($('a', this).is('[rel*=external]')){
window.open(href);
return false;
} else {
window.location = href;
@basvandorst
basvandorst / RegisterController.php
Created May 31, 2012 11:12
@maurice; Check this example of RegisterController.php with activateAction
<?php
class RegisterController extends Zend_Controller_Action {
public function init ()
{
$this->view->title = 'Register';
$this->view->menu = 'home';
}
public function indexAction() {
@basvandorst
basvandorst / BolController.php
Created June 29, 2012 08:22
Example Zend Bol.com REST Controller
<?php
class BolController extends Zend_Controller_Action {
private function getSignature($date, $httpMethod, $url, $contentType, $queryParams) {
$signature = $httpMethod . "\n\n";
$signature .= $contentType . "\n";
$signature .= $date."\n";
$signature .= "x-openapi-date:" . $date . "\n";
$signature .= $url."\n";
@basvandorst
basvandorst / Zend_Mail_InlineImages.php
Created August 21, 2012 13:48
Zend_Mail inline images in e-mail: CID attachment (tested in Gmail, Outlook.com, Outlook 2010)
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
@basvandorst
basvandorst / huawei-find-password.py
Created August 8, 2014 12:45
Find the admin password of your Huawei DSL modem
#!/usr/bin/env python
# find-password.py
# Find the admin password of your Huawei DSL modem
#
# Author: Bas van Dorst
import optparse
import urllib2
import re