Skip to content

Instantly share code, notes, and snippets.

View johnsardine's full-sized avatar

João Sardinha johnsardine

View GitHub Profile
@johnsardine
johnsardine / jquery.chosen.js
Created March 24, 2013 17:15
jQuery Chosen with title attribute. May be helpful to provide contextual information when multiple options have the same label.
// Chosen, a Select Box Enhancer for jQuery and Protoype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 0.9.8
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
// This file is generated by `cake build`, do not edit it by hand.
(function() {
<?php
class Input
{
public static function get($key = null, $default = null)
{
if (!$key)
return $_GET;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<title>iOS Web App</title>
<!-- iPhone -->
<tbody><tr>
<td style="padding-bottom: 15px; vertical-align: top; width: 1%; text-align:center;"><img src="images/gathering.jpg" alt="Crab Meat Knife" height="176" width="176" style="margin-bottom: 10px">Crab Meat Knifssse</td>
<td style="padding-bottom: 15px; vertical-align: top; width: 1%; text-align:center;"><img src="images/gathering.jpg" alt="Crab Meat Knife" height="176" width="176" style="margin-bottom: 10px">Crab Meat Knife</td>
<td style="padding-bottom: 15px; vertical-align: top; width: 1%; text-align:center;"><img src="images/gathering.jpg" alt="Crab Meat Knife" height="176" width="176" style="margin-bottom: 10px">Crab Masdasdnife</td>
</tr>
<tr>
<td style="padding-bottom: 15px; vertical-align: top; width: 1%; text-align:center;"><img src="images/gathering.jpg" alt="Crab Meat Knife" height="176" width="176" style="margin-bottom: 10px">Crab sssMeat Knife</td>
<td style="padding-bottom: 15px; vertical-align: top; width: 1%; text-align:center;"><img src="images/gathe
@johnsardine
johnsardine / Parse.php
Created July 23, 2013 15:48
O ficheiro Parse.php corre uma instancia da class ParseFile para cada ficheiro.
<?php namespace Tailor\Carmim;
use log;
use SplFileObject;
use Illuminate\Support\Facades\File;
use Symfony\Component\Finder\SplFileInfo;
class Parse
{
/*
<!-- Third party script for BrowserPlus runtime (Google Gears included in Gears runtime now) -->
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<!-- Load plupload and all it's runtimes and finally the jQuery queue widget -->
<script type="text/javascript" src="/plupload/js/plupload.full.js"></script>
<script type="text/javascript">
// Custom example logic
$(function() {
<?php
// This is the database connection configuration
$db_config = array(
'host' => 'localhost', // Your server
'database' => 'demo', // Database name
'username' => 'root', // Username
'password' => '', // Password
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
@johnsardine
johnsardine / gist:6776067
Created October 1, 2013 09:39
Simple templating javascript using jquery
// Add this to runtime
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
jQuery.expr[':'].contains = function(a, i, m) {
var rExps=[
{re: /[\xC0-\xC6]/g, ch: "A"},
{re: /[\xE0-\xE6]/g, ch: "a"},
{re: /[\xC8-\xCB]/g, ch: "E"},
{re: /[\xE8-\xEB]/g, ch: "e"},
{re: /[\xCC-\xCF]/g, ch: "I"},
{re: /[\xEC-\xEF]/g, ch: "i"},
{re: /[\xD2-\xD6]/g, ch: "O"},
{re: /[\xF2-\xF6]/g, ch: "o"},
@johnsardine
johnsardine / Pagination.php
Last active December 26, 2015 18:29
PHP Pagination, estracted from CodeIgniter and simplified
<?php
class Pagination {
var $base_url = ''; // The page we are linking to
var $prefix = 'page'; // A custom prefix added to the path.
var $suffix = ''; // A custom suffix added to the path.
var $total_rows = 0; // Total number of items (database results)
var $per_page = 10; // Max number of items you want shown per page
var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page