Skip to content

Instantly share code, notes, and snippets.

View devluis's full-sized avatar

Alberto Hernández devluis

View GitHub Profile
@devluis
devluis / php-class-to-read-psd-files
Created December 29, 2013 20:14
PHP class to read PSD files
<?
/* This file is released under the GPL, any version you like
*
* PHP PSD reader class, v1.3
*
* By Tim de Koning
*
* Kingsquare Information Services, 22 jan 2007
*
* example use:
@devluis
devluis / all-favicons.html
Created November 1, 2014 19:16
Snippet Favicons for all devices
<!-- Favicon for old browsers -->
<link rel="shortcut icon" type="image/x-icon" href="img/favicon/16.ico"/>
<!-- Favicons for browser with out support .ico file -->
<link rel="icon" type="image/png" href="img/favicon/16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="img/favicon/32x32.png" sizes="32x32">
<!-- For Google TV -->
<link rel="icon" type="image/png" href="img/favicon/96x96.png" sizes="96x96">
@devluis
devluis / horizontal-responsive-multilevel-menu.html
Last active June 9, 2021 14:38
Responsive Multilevel Horizontal Menu only with CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Responsive Multilevel Horizontal Menu</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
<style>
#menu ul {
margin: 0;
padding: 0;
@devluis
devluis / gist:6233667
Created August 14, 2013 17:57
Hide part of image with css without cropping image
<style>
.container {
width: 418px;
height: 240px;
overflow: hidden;
}
.container img {
width: 100%;
}
</style>
@devluis
devluis / live-word-counter-jquery
Created December 6, 2013 05:35
Live Word and Character Counter using jQuery
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>Live Word and Character Counter using jQuery</title>
<style>
textarea{
@devluis
devluis / sql-return-records-last-hour
Created December 28, 2013 21:27
Select SQL to return records in the last hour
SELECT *
FROM tbl_name
WHERE creation_time > DATE_SUB(NOW(),INTERVAL 1 HOUR)
@devluis
devluis / check-if-exist-email.php
Last active January 23, 2019 20:21
Script to check if email exist using PDO
<?php
DEFINE('DB_USER', 'YOUR_DATA_BASE_USER');
DEFINE('DB_PASSWORD', 'YOUR_DATA_BASE_PASSWORD');
DEFINE('DB_HOST','YOUR_HOST');
DEFINE('DB_NAME','YOUR_DATA_BASE_NAME');
$email = 'email-to-search@mydomain.com';
$con = new PDO( 'mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=UTF-8',DB_USER,DB_PASSWORD );
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@devluis
devluis / validate-email-with-regular-expression-php
Created December 29, 2013 20:07
validate email with regular expression in PHP
<?php
$email = "someone@example.com";
if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
echo "Valid email address.";
}
else {
echo "Invalid email address.";
}
@devluis
devluis / list-images-inside-folder
Created December 29, 2013 20:05
List images inside folder
<?php
if ($handle = opendir('myFolder')) {
echo "Directory handle: $handle\n";
echo "Files:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
echo $file."<br />";
}