Skip to content

Instantly share code, notes, and snippets.

View devluis's full-sized avatar

Alberto Hernández devluis

View GitHub Profile
@devluis
devluis / replace-special-chars.php
Created December 12, 2014 20:54
Replace special chars in php
<?php
$stringOriginal = "Este string contiene acentos, ÁFRICA, MÉXICO, ÍNDICE, CANCIÓN y NÚMERO.";
$specialChars = array("á", "é", "í", "ó", "ú", "Á", "É", "Í", "Ó", "Ú", "ñ", "Ñ");
$replacementChars = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U", "n", "N");
$replacedString = str_replace($specialChars, $replacementChars, $originalString);
print $replacedString; // output 'Este string contiene acentos, ÁFRICA, MÉXICO, ÍNDICE, CANCIÓN y NÚMERO.'
@devluis
devluis / styles-placeholder.css
Created December 15, 2014 02:20
Style Placeholder Text
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder { /* Firefox 18- */
color: red;
}
::-moz-placeholder { /* Firefox 19+ */
color: red;
@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 / multiple-markers-google-maps.html
Created February 19, 2015 20:46
Google Maps Multiple Markers
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 400px;"></div>
@devluis
devluis / com.mysql.mysql.plist
Created March 21, 2015 17:30
Auto-load MySQL on startup on OSX Yosemite
First, create a new file: /Library/LaunchDaemons/com.mysql.mysql.plist
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true />
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>ProgramArguments</key>
function getSignature() {
//pretty basic function for testing
if ( startupChecks()) { return; }
var email = SpreadsheetApp.getActiveSpreadsheet().getActiveCell().getValue().toString();
if ( email === "" ) {
Browser.msgBox("No email selected", "Please select a cell containing a user's email" , Browser.Buttons.OK);
return;
}
var result = authorisedUrlFetch(email, {});
Browser.msgBox(result.getContentText());
<?php
/* Source: http://www.apphp.com/index.php?snippet=php-get-remote-ip-address */
function makeMyUrlFriendly($url){
$output = preg_replace("/\s+/" , "_" , trim($url));
$output = preg_replace("/\W+/" , "" , $output);
$output = preg_replace("/_/" , "-" , $output);
return strtolower($output);
}
?>