Skip to content

Instantly share code, notes, and snippets.

// see: http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/
// for context.
// this modifies original code (above) to also watch for dialogs being hidden
$('div[data-role="page"],div[data-role="dialog"]').live('pagehide', function (event, ui) {
$(event.currentTarget).remove();
});
@iloris
iloris / config.xml
Created July 8, 2013 19:18
Phonegap config file
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.site.app" version="0.0.10" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>MyApp</name>
<description>
MyApp allow you to do stuff.
</description>
<author email="[email protected]" href="http://myapp.com">
MyApp Team
</author>
@iloris
iloris / is_ssl.php
Created April 22, 2013 22:19
PHP SSL redirection
<?php
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
@iloris
iloris / address-form.html
Created March 21, 2013 01:46
Generic html address form using twitter bootstrap form. inspiration: http://www.uxmatters.com/mt/archives/2008/06/international-address-fields-in-web-forms.php
<form class="form-horizontal">
<fieldset>
<!-- Address form -->
<h2>Address</h2>
<!-- full-name input-->
<div class="control-group">
<label class="control-label">Full Name</label>
<div class="controls">
<?php
/**
* Changelog Markdown
*
* This is a script to transform GIT LOG into a cute format Changelog.md
*
* To use, set executable permissions to this file and execute:
* $ php changelog.php > CHANGELOG.md
*
* Copyright (c) 2013 João Pinto Neto
password
123456
12345678
1234
qwerty
12345
dragon
pussy
baseball
football
<script type="text/javascript">
var getUrlParams = function() {
var params = {}, hash;
var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&');
for (var i=0; i<hashes.length; i++) {
hash = hashes[i].split('=');
params[hash[0]] = hash[1];
}
return params;
};
@iloris
iloris / ga_php.php
Created January 14, 2013 05:01
Google Analytics Push using PHP
<?php
/**
* Code modified by @labnol to add print tracking
* version 1.0 date 01/03/2012
* based on PHP Mobile Tracking code by Google.
**/
define("VERSION", "4.4sh");
define("COOKIE_NAME", "__utmprint");
@iloris
iloris / rfc822.php
Created November 4, 2012 16:18
Validate an email with php function
<?php
#
# RFC 822/2822/5322 Email Parser
#
# By Cal Henderson <[email protected]>
#
# This code is dual licensed:
# CC Attribution-ShareAlike 2.5 - http://creativecommons.org/licenses/by-sa/2.5/
# GPLv3 - http://www.gnu.org/copyleft/gpl.html
@iloris
iloris / gist:3350190
Created August 14, 2012 15:14
Proxy detection php
<?php
if (
$_SERVER['HTTP_X_FORWARDED_FOR']
|| $_SERVER['HTTP_X_FORWARDED']
|| $_SERVER['HTTP_FORWARDED_FOR']
|| $_SERVER['HTTP_CLIENT_IP']
|| $_SERVER['HTTP_VIA']
|| in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
|| @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))
{