Skip to content

Instantly share code, notes, and snippets.

View Ultrabenosaurus's full-sized avatar

Dan Bennett Ultrabenosaurus

  • UK
View GitHub Profile
@jrivero
jrivero / cachedHTMLForURL.php
Created September 24, 2012 11:12
Retrieve Google Cached HTML
<?php
// http://hactheplanet.com/blog/11
function cachedHTMLForURL($url)
{
// Request the cache from Google.
$googleRequestURL = "http://webcache.googleusercontent.com/search?q=" . urlencode("cache:" . $url);
$googleResponse = file_get_contents($googleRequestURL);
@cgiffard
cgiffard / ietest.js
Created September 24, 2012 10:22
Don't have a copy of IE8 available to me right now. Can anybody tell me whether this will work?
(window.attachEvent||window.addEventListener)("load",function() {
// Event listener code in here
alert("will this fire in IE8?");
},false);
@vinhnx
vinhnx / Ciapre.tmTheme
Created September 21, 2012 12:30
Ciapre - Sublime Text 2 color scheme. based on https://github.com/cyrilmengin/andro
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Vinh Nguyen</string>
<key>name</key>
<string>Ciapre</string>
<key>settings</key>
<array>
@xeoncross
xeoncross / gdrivecms.php
Created September 20, 2012 14:37 — forked from timwis/gdrivecms.php
GDriveCMS allows you to use Google Docs' familiar interface for adding content to a mobile-optimized web page. Simply create a Google Document with whatever content you want, publish it to the web (in the File menu), and render it through this script.
<?php
/* GDriveCRM
Created by Tim Wisniewski (timwis.com)
GDriveCMS allows you to use Google Docs' familiar interface for adding content to a mobile-optimized web page.
Simply create a Google Document with whatever content you want, publish it to the web (in the File menu),
and render it through this script.
1. Create a document in Google Drive (Google Docs)
2. Go to File > Publish to the web
3. Click Start Publishing & check Automatically republish
4. Grab the document link (URL) in that dialog
@damien-list
damien-list / gist:3749365
Created September 19, 2012 12:22
Input & Textarea Character Limit Display with jQuery
(function($) {
$.fn.extend( {
limiter: function(limit, elem) {
$(this).on("keyup focus", function() {
setCount(this, elem);
});
function setCount(src, elem) {
var chars = src.value.length;
if (chars > limit) {
src.value = src.value.substr(0, limit);
@fitorec
fitorec / android.logo.html
Created September 19, 2012 09:13
logo android en puro HTML & CSS
<!DOCTYPE html>
<html lang="es-MX">
<head>
<title>logo android</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css" media="all">
#perspective-container { position: absolute; top: 0px; width: 264px; height: 336px; background-color: rgba(0,0,0,.05); -moz-transform-style: preserve-3d; -moz-perspective: 800px;}
#android { position: absolute; top: 0px; width: 264px; height: 336px;}
#android .body { position: absolute; top: 110px; left: 48px; width: 168px; height: 152px; border-radius: 0px 0px 30px 30px; background-color: #ED8415;}
#android .head { position: absolute; top: 30px; left: 48px; width: 168px; height: 68px; border-top-left-radius: 50% 100%; border-top-right-radius: 50% 100%; background-color: #ED8415; }
@madsanton
madsanton / Default (Linux).sublime-keymap
Created September 18, 2012 13:30 — forked from coldnebo/Default (Linux).sublime-keymap
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@thathollywood
thathollywood / chat-frontend.js
Created September 13, 2012 14:09 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@cyrusbeer
cyrusbeer / application.js
Created September 13, 2012 11:58
Intercepts urls on your site and instead makes ajax calls and then changes the url shown in the browser with pushState to make it look like the original url was submitted.
$(function( $ ) {
$(document).ready(function() {
$(".ajax-intercept").ajaxInterceptor({
pageElementToUpdateSelector: "div#content",
showLoadingMessage: true,
loadingMessageDelay: 600,
loadingMessage: 'Loading...',
@ronnyhaase
ronnyhaase / formatTime.js
Last active October 10, 2015 15:47
Format time by hour of the day and minute of the hour
/**
* Returns formatted time depending on the clock (e.g. 00:00 / 12:00am)
* @param {number} hour - The hour of the day (0-24)
* @param {number} minute - The minute of the the hour (0-59)
* @param {string} clock - Either "12h" or "24h"
* @returns The time as a well formated string or false in case of an error
*/
function formatTime(hour, minute, clock) {
( minute < 10 )
? minute = '0' + minute