Skip to content

Instantly share code, notes, and snippets.

View fadonascimento's full-sized avatar

Fabricio Henrique fadonascimento

View GitHub Profile
@irae
irae / _Stay_standalone.md
Last active January 29, 2024 12:38 — forked from kylebarrow/example.html
Stay Standalone: Prevent links in standalone web apps opening Mobile Safari

#Stay Standalone

A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.

@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@BaylorRae
BaylorRae / PubSub.php
Created December 21, 2011 06:08
PubSub class for PHP
<?php
class PubSub {
private static $events = array(); // all subscriptions
// Don't allow PubSub to be initialized outside this class
private function __construct() {}
private function __clone() {}
@peteboere
peteboere / jquery.alterclass.js
Created December 24, 2011 12:49
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/
@juanmhidalgo
juanmhidalgo / js-toSlug.js
Created July 19, 2012 20:55
JavaScript toSlug()
String.prototype.toSlug = function(){
st = this.toLowerCase();
st = st.replace(/[\u00C0-\u00C5]/ig,'a')
st = st.replace(/[\u00C8-\u00CB]/ig,'e')
st = st.replace(/[\u00CC-\u00CF]/ig,'i')
st = st.replace(/[\u00D2-\u00D6]/ig,'o')
st = st.replace(/[\u00D9-\u00DC]/ig,'u')
st = st.replace(/[\u00D1]/ig,'n')
st = st.replace(/[^a-z0-9 ]+/gi,'')
st = st.trim().replace(/ /g,'-');
@shrimpwagon
shrimpwagon / Odbc.php
Last active December 15, 2015 05:19 — forked from ceeram/Odbc.php
(NOT WORKING YET) CakePHP database class for specifically working with MS SQL Server via FreeTDS. Might be able to work with other ODBC databases, not sure. For more info on setting up a Linux/PHP/PDO/FreeTDS/MSSQL connection environment, please visit: https://secure.kitserve.org.uk/content/accessing-microsoft-sql-server-php-ubuntu-using-pdo-odb…
<?php
/**
* ODBC layer for DBO
* Helpful for Linux connection to MS SQL Server via FreeTDS
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@andrebian
andrebian / facebook.php
Created August 20, 2014 18:38
Facebook API example
<?php
// No controller
public function facebookLogin() {
$facebook = new Facebook(array(
'appId' => 'SEU ID',
'secret' => 'SEU SECRET',
));
$loginUrl = $facebook->getLoginUrl(array(
@jirutka
jirutka / sample.png
Last active April 26, 2023 14:03
Nested numbered list with correct indentation in CSS. Live example at http://jsfiddle.net/a84enL8k/.
sample.png
@jbouzekri
jbouzekri / FeatureContext.php
Created February 27, 2015 18:48
A nice wait for js calls ending function in behat
<?php
/**
* @author Gildas Quéméner <gildas@akeneo.com>
* @copyright 2013 Akeneo SAS (http://www.akeneo.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
use Behat\Behat\Exception\BehaviorException;
use Behat\Mink\Driver\Selenium2Driver;
@keopx
keopx / import_gzip_drush.sh
Created July 16, 2015 18:36
Import gzipped sql using Drush
gunzip -c database.sql.gz | drush sqlc