Skip to content

Instantly share code, notes, and snippets.

View vivirenremoto's full-sized avatar
🍗

vivirenremoto vivirenremoto

🍗
View GitHub Profile
@vivirenremoto
vivirenremoto / gist:9808497
Last active August 29, 2015 13:57
buscar imágenes <img> o [img] en un texto
<?php
$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXPath($doc);
$src = $xpath->evaluate("string(//img/@src)");
?>
{
"require": {
"facebook/php-sdk": "dev-master"
}
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(function(){
$("#product").change(function(
$.ajax({
url: "index.php?obtenedatos&id=" + $(this).val(),
}).done(function(datos) {
$("#info").val(datos);
});
));
<?php
// http://www.movele.es/index.php/mod.puntos/mem.mapa/relmenu.20/regini.0/numregs.330
require 'class/simple_html_dom/simple_html_dom.php';
$url = 'http://www.movele.es/index.php/mod.puntos/mem.mapa/relmenu.20/regini.0/numregs.330';
$html = file_get_html($url);
@vivirenremoto
vivirenremoto / gist:4678e654aeca0753c8b0
Last active August 29, 2015 14:02
miquelcamps.json
{
"name":"Miquel Camps Orteza",
"tagline":"freelance developer and betabeers organizer",
"photo":"http://graph.facebook.com/miquel.camps/picture?type=large",
"location":{
"city":"Alcorcón, Madrid",
"country":"Spain"
},
"url":"http://miquelcamps.com",
"birthdate":"1986-06-02",
@vivirenremoto
vivirenremoto / gist:ae6d53276602dcecd822
Created July 2, 2014 08:17
accept all linkedin invitation requests
javascript:for(i=0;i<$('div.button-group').size();i++){$('div.button-group:eq('+i+')').find('A').click();setTimeout(function(){location.reload();},6000);}
@vivirenremoto
vivirenremoto / gist:5e7e88de493951ae277e
Last active August 29, 2015 14:05
textexpander dev snippets
hhtml
<!doctype html>
<html lang="en">
<head>
<title>Document</title>
<meta charset="UTF-8" />
</head>
<body>
%|
</body>
@vivirenremoto
vivirenremoto / gist:5b7561f9c564e93b7eee
Last active August 29, 2015 14:08
carlton banks injection
javascript:var newdiv = document.createElement('div');newdiv.innerHTML = '<img src="http://i.imgur.com/YdmGHYG.gif" style="position:fixed;right:0;bottom:0"><audio autoplay><source src="http://40mp3.com/music/user-files-30/0000/all-genre/074%20-%20Its%20Not%20Unusual%20-%20Tom%20Jones%20-%201391998460.mp3" type="audio/mpeg"></audio>';document.body.appendChild(newdiv);
@vivirenremoto
vivirenremoto / gist:9d3caaf01a32c30811de
Created November 16, 2014 09:32
comic sans injection
javascript:var div_new = document.createElement('div');div_new.innerHTML = "<style>*{font-family:'comic sans ms';}</style>";document.body.appendChild(div_new);
@vivirenremoto
vivirenremoto / gist:39cfb9b76457aaf277a8
Created December 28, 2014 03:22
create friendly url
<?php
function getSlug($str, $replace=array(' con ', ' de ', ' para ', ' y ', ' en ', ' of '), $delimiter='-') {
if( !empty($replace) ) $str = str_replace((array)$replace, ' ', $str);
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower(trim($clean, '-'));
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
$clean = str_replace('--','-', $clean);
return $clean;