Skip to content

Instantly share code, notes, and snippets.

View devluis's full-sized avatar

Alberto Hernández devluis

View GitHub Profile
@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 protected]';
$con = new PDO( 'mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=UTF-8',DB_USER,DB_PASSWORD );
@devluis
devluis / README.md
Created November 12, 2013 04:38 — forked from oodavid/README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@devluis
devluis / gist:7156231
Created October 25, 2013 15:09
Show hidden files and directories on Mac
#To show hidden files
defaults write com.apple.finder AppleShowAllFiles TRUE
#To hide hidden files
defaults write com.apple.finder AppleShowAllFiles FALSE
//create the window
var win1 = Ti.UI.createWindow(
{
backgroundColor:"#fff",
title: "Concurso"
}
);
//create navigation group
var navGroup = Titanium.UI.iPhone.createNavigationGroup(
@devluis
devluis / gist:7046443
Created October 18, 2013 19:02
CSS font-face
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@devluis
devluis / app.js
Created October 17, 2013 20:48 — forked from FokkeZB/app.js
var win = Ti.UI.createWindow();
var webView = Ti.UI.createWebView({
url: 'http://www.youtube.com/embed/' + myVideoID + '?autoplay=1&autohide=1&cc_load_policy=0&color=white&controls=0&fs=0&iv_load_policy=3&modestbranding=1&rel=0&showinfo=0',
enableZoomControls: false,
scalesPageToFit: false,
scrollsToTop: false,
showScrollbars: false
});
@devluis
devluis / app.js
Created October 10, 2013 23:00 — forked from appcdr/app.js
Ti.UI.backgroundColor = '#dddddd';
var url = "https://raw.github.com/appcelerator/Documentation-Examples/master/HTTPClient/data/json.txt";
var win = Ti.UI.createWindow();
var table = Ti.UI.createTableView();
var tableData = [];
var json, fighters, fighter, i, row, nameLabel, nickLabel;
var xhr = Ti.Network.createHTTPClient({
onload: function() {
@devluis
devluis / gist:6709785
Created September 26, 2013 04:14
Show random image when refresh page
<?php
srand( microtime() * 10000 );
$num = rand( 1, 3 ); # Random range
switch( $num ){
case 1: $image_file = "mi-imagen-1.jpg";
break;
case 2: $image_file = "mi-imagen-2.jpg";
@devluis
devluis / gist:6551899
Created September 13, 2013 15:03
Link on webapp to switch desktop version witch coldfusion
<!--- Check if parameter nomobile exist in URL --->
<cfif structKeyExists(url, "nomobile")>
<!--- If exist SET session on TRUE and show desktop version--->
<cfset session.nomobile = true>
<!--- If not exist redirect to mobile version--->
<cfelse>
<cfif reFindNoCase("android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino",CGI.HTTP_USER_AGENT) GT 0 OR reFindNoCase("1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(
@devluis
devluis / gist:6527564
Created September 11, 2013 18:15
Add active class to a navigation menu based on URL
<!DOCTYPE html>
<html>
<head>
<style>
#nav {
margin:200px auto;
width:430px;
}
#nav ul {