Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Define google url shortener api
*/
define("API_URL", "https://www.googleapis.com/urlshortener/v1/url?key=");
class GoogleURL
{
/**
*
@sophy
sophy / jCarousel.js
Created February 16, 2012 04:44
Slide show
/*!
* jCarousel - Riding carousels with jQuery
* http://sorgalla.com/jcarousel/
*
* Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Built on top of the jQuery library
* http://jquery.com
@sophy
sophy / index.html
Created July 2, 2012 08:51
A web page created at CodePen.io
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Piggy &middot; CodePen</title>
<link rel="stylesheet" href="http://codepen.io/stylesheets/css/normalize.css">
<?php
/**
* Adds a view to the post being viewed
*
* Finds the current views of a post and adds one to it by updating
* the postmeta. The meta key used is "tpost_views".
*
* @global object $post The post object
* @global WP_Query $wpdb
* @return integer $new_views The number of views the post has
<?php
$rg = "/[0-9]{3}/";
preg_match($rg, '208') //true
preg_match($rg, '2098') //false
preg_match($rg, 234) //false
?>
@sophy
sophy / exam-1.sql
Last active December 19, 2015 07:18
-- QUESTION 1
SELECT
customer.name,
customer.address,
software.name,
softwares_ordering.quantity
FROM
customer, software, softwares_ordering
WHERE (customer.id_customer = softwares_ordering.id_customer)
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteRule (wordpress/.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Tutorial
========
1. http://mobile.smashingmagazine.com/2013/04/03/build-fast-loading-mobile-website/
2. http://moz.com/blog/15-tips-to-speed-up-your-website
3. http://www.aleydasolis.com/en/mobile-web-seo-tools/
4. http://www.netmagazine.com/features/speeding-mobile-html5-experiences
5. http://www.socialmediaexaminer.com/5-simple-steps-to-getting-started-with-mobile-marketing/
6. http://stackoverflow.com/questions/9511526/auto-mobile-site-redirect
7. http://mobile.smashingmagazine.com/2013/08/12/creating-high-performance-mobile-websites/
8. http://css-tricks.com/which-responsive-images-solution-should-you-use/
add_filter('comment_form_default_fields', 'url_filtered');
function url_filtered($fields)
{
if(isset($fields['url']))
unset($fields['url']);
if(isset($fields['email']))
unset($fields['email']);
return $fields;
}