Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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");