Skip to content

Instantly share code, notes, and snippets.

@oriolrivera
oriolrivera / icons-social.html
Created April 1, 2014 21:01
iconos sociales con css y js
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400);
@import "http://netdna.bootstrapcdn.com/font-awesome/3.0/css/font-awesome.css";
<?php
foreach ($viewInclude as $vIN) {
foreach ($viewIncludeEdit as $vIE) {
if ($vIE["includes_place_rel_id"]==$vIN["id_includes"]) {
?>
<div class="col-md-6">
<input type="checkbox" name="inclu[]" style="margin:5px" value="<?php echo $vIN["id_includes"]; ?>" checked>
<?php echo $vIN["name_includes"]; ?>
</div>
@oriolrivera
oriolrivera / tasadolar.php
Created June 9, 2014 16:37
Obtener tasa de cambio del dolar en PHP
<?php
$datafeed= file_get_contents("http://rate-exchange.appspot.com/currency?from=USD&to=DOP");
$obj = json_decode($datafeed);
echo $obj->{'rate'};
?>
@oriolrivera
oriolrivera / sitemap.php
Last active August 29, 2015 14:02
mapa del sitio dinamico con php
<?php
header("Content-type: text/xml");
$xml = new DomDocument('1.0', 'utf-8');
$xml->formatOutput = true;
// creating base node
$urlset = $xml->createElement('urlset');
$urlset -> appendChild(
@oriolrivera
oriolrivera / index.php
Last active August 29, 2015 14:03
tabla, bucle html
<?php
$tr=null;
$trend=null;
$nametest=null;
for ($i=0; $i < 4; $i++) {
$tr.='<tr>';
@oriolrivera
oriolrivera / index.php
Created July 4, 2014 15:17
Conversor de moneda usando la API de Google
<?php
/* conversor_divisas()
*
* Conversor de moneda usando la API de Google
*/
function currency($from, $to, $amount)
{
@oriolrivera
oriolrivera / paypal.php
Created July 7, 2014 00:51
Ejemplo de pago mediante la API de PayPal
<html>
<head>
<title>Ejemplo de pago mediante la API de PayPal</title>
</head>
@oriolrivera
oriolrivera / index.php
Created July 25, 2014 14:36
crear y eliminar folder php
<?php
// Creamos un directorio o carpeta
$directorio = "mis_fotos";
$dirmake = mkdir("$directorio", 0777);
?>
===================================
<?php
// Eliminamos un directorio o carpeta vacio
@oriolrivera
oriolrivera / index.php
Created July 27, 2014 21:46
limpiar url amigables
<?php
/**
* [stringUrl limpiar url amigables]
* @return [type] [string]
*/
public static function stringUrl($String) {
$String = trim($String);
$stringArray = array(
'Š'=>'S', 'š'=>'s', 'Ž'=>'Z', 'ž'=>'z', 'C'=>'C', 'c'=>'c', 'C'=>'C', 'c'=>'c',
@oriolrivera
oriolrivera / script.js
Last active August 29, 2015 14:04
validar solo letras sin espacios en blanco en input
function validarn(e) {
tecla = (document.all) ? e.keyCode : e.which;
if (tecla==8) return true;
if (tecla==9) return true;
if (tecla==11) return true;
if (tecla==32) return false;
patron = /[A-Za-zñÑ'áéíóúÁÉÍÓÚàèìòùÀÈÌÒÙâêîôûÂÊÎÔÛÑñäëïöüÄËÏÖÜ\s\t]/; // 4
te = String.fromCharCode(tecla);
return patron.test(te);