Skip to content

Instantly share code, notes, and snippets.

View shapeshifta78's full-sized avatar
💜
fiddling

Thomas Horster shapeshifta78

💜
fiddling
View GitHub Profile
@shapeshifta78
shapeshifta78 / tabs.html
Created December 31, 2010 11:46
Simple jQuery tabs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jquery Tabs</title>
<style type="text/css">
body {margin:0;padding:0;font: bold 11px/1.5em Verdana;background:#666; color:#fff}
h2 {font: bold 14px Verdana, Arial, Helvetica, sans-serif;color: #fff;margin:20px 0 0 0;padding: 0 0 0 15px}
img {border: none}
a img {border:0}
@shapeshifta78
shapeshifta78 / mini.js
Created July 13, 2011 16:17
Javascript Miniframework
//implement missing function
if(!document.getElementsByClassName){
document.getElementsByClassName = function(cl) {
var retnode = [],
myclass = new RegExp('\\b'+cl+'\\b'),
elem = this.getElementsByTagName('*');
for (var i = 0, max = elem.length; i < max; i++) {
var classes = elem[i].className;
if (myclass.test(classes)){
retnode.push(elem[i]);
@shapeshifta78
shapeshifta78 / gist:1354460
Created November 10, 2011 08:57
Web Timings Api Test
$(window).load(function(){
(function (win){
var performance =
win.performance ||
win.webkitPerformance ||
win.mozPerformance ||
win.msPerformance ||
{},
timings = performance.timing || {},
testLoad = function(){
@shapeshifta78
shapeshifta78 / grunt.js
Created August 3, 2012 14:48 — forked from pamelafox/grunt.js
Grunt for a CSS/JS WebApp
/*global module:false*/
module.exports = function(grunt) {
var CSS_DIR = 'src/css/';
var JS_DIR = 'src/js/';
var BUILD_DIR = '../build/';
// Project configuration.
grunt.initConfig({
@shapeshifta78
shapeshifta78 / install-nodejs.sh
Created August 13, 2012 08:11 — forked from TooTallNate/install-nodejs.sh
Simple Node.js installation script using the precompiled binary tarballs
#!/bin/sh
#version details
VERSION=0.8.8
PLATFORM=linux
ARCH=x86
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
#download binaries
mkdir -p "$PREFIX" && \
@shapeshifta78
shapeshifta78 / gist:3340982
Created August 13, 2012 13:52
Phantom.js Installation made easier :)
#!/bin/sh
#version details
VERSION=1.6.1
PLATFORM=linux
ARCH=i686
FILE="phantomjs-$VERSION-$PLATFORM-$ARCH-dynamic"
#download binaries
wget -O $HOME/$FILE.tar.bz2 http://phantomjs.googlecode.com/files/$FILE.tar.bz2
@shapeshifta78
shapeshifta78 / vhosts.sh
Created November 29, 2012 07:10
Show all vhosts on system
#!/bin/bash
#list vhosts
IFS=$'\n'
for line in `ls -1 "$HOME/conf/apache2/sites-enabled"`;
do
grep "<VirtualHost " "$HOME/conf/apache2/sites-enabled/$line"
grep "DocumentRoot " "$HOME/conf/apache2/sites-enabled/$line"
done
#or just use sudo apache2ctl -S
<?php
$url = $_GET['url'];
$allowedurls = array(
'http://developer.yahoo.com',
'http://icant.co.uk'
);
if(in_array($url,$allowedurls)){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@shapeshifta78
shapeshifta78 / jqueryui-mobile-slider.js
Last active December 23, 2015 00:09
Simulate mouseevents for jqueryui slider on mobile devices
$('#slider').on('touchstart touchmove touchend', 'a.ui-slider-handle', function (event) {
//mousevents to simulate on touch
var touchEvents = {
touchstart: 'mousedown',
touchmove: 'mousemove',
touchend: 'mouseup'
};
//get element and type of event to simulate
var simulatedEvent = touchEvents[event.originalEvent.type],
@shapeshifta78
shapeshifta78 / gist:9d9cb943259a23c4b3d1
Last active August 29, 2015 14:13
disable back button
(function (w) {
w.location.hash = '#no-back';
var historyApi = (typeof w.history.pushState !== 'undefined');
if (w.location.hash == '#no-back') {
if (historyApi) {
w.history.pushState(null, '', '#stay');
} else {
w.location.hash = '#stay';