Skip to content

Instantly share code, notes, and snippets.

View ferminhg's full-sized avatar
🐙
WFH

fermin ferminhg

🐙
WFH
View GitHub Profile
@ferminhg
ferminhg / gist:4130856
Created November 22, 2012 12:14
HTML: Starting Template
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title></title>
</head>
<body>
</body>
</html>
@ferminhg
ferminhg / gist:4130948
Created November 22, 2012 12:29 — forked from padolsey/gist:527683
Javascript: Detect IE
var ie = (function(){
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]
@ferminhg
ferminhg / gist:4135322
Last active October 13, 2015 03:57
PHP-Unit: Fichero Base Clase PHP-Unit
<?php
/**
* Clase para PHP-UNIT que carga el document_root por parametros para
* carga de librerias como esta desarollado en marcadores.
*/
if(isset($_SERVER['argv'][2])) {
if(!is_dir($_SERVER['argv'][2])) {
echo("El DocumentRoot especificado no existe o no es correcto.");
exit;
@ferminhg
ferminhg / gist:4538021
Created January 15, 2013 11:37
PHP: buscar dentro de un array de objectos un valor para una key
/**
* Busca tipo de noticias por valor
* @param $key
* @param $value
*/
public static function search($key, $value)
{
$atp = self::getAll();
$ret = null;
foreach ($atp as $object) {
@ferminhg
ferminhg / gist:4714058
Last active December 12, 2015 04:28
SSH: Detectar si una web esta o no caida
#!/bin/sh
ping -c 1 server.com >/dev/null 2>&1
if [ "$?" != 0 ]
then
echo "down :_("
date
else
echo "up :-)"
{
"id": "04649-01",
"proveedor": "0.603.127.000",
"nombre": "Taladro BOSCH PSB 500 RE",
"stock": "3",
"reserva": 0,
"imagen": "http://estaticos.planetahuerto.es/estaticos/imagenes/articulo/4649/4649_1.jpg"
}
@ferminhg
ferminhg / gist:c6b2343962564e56a541
Created September 5, 2014 10:19
Redefine BOOL in Obj-C
typedef signed char BOOL;
#define OBJC_BOOL_DEFINED
#define YES (BOOL)GIVER
#define NO (BOOL)RECEIVER
// to push, add in the UIViewController :
MyUIViewController *second = [[LoginUIViewController alloc] initWithNibName:nil bundle:nil];
[self presentViewController:second animated:YES completion:nil];
// in the second view controller add
[self dismissViewControllerAnimated:YES completion:nil];
@ferminhg
ferminhg / app.php
Last active August 29, 2015 14:07 — forked from franmomu/app.php
<?php
require_once __DIR__.'/vendor/autoload.php';
use Goutte\Client;
$client = new Client();
// Login page
$crawler = $client->request('GET', 'http://x3demob.cpx3demo.com:2082/?locale=en');
@ferminhg
ferminhg / gist:b45ad662be2faca3e109
Last active August 29, 2015 14:07
Example mm.json
{
"listado" :
[{"provincia": 12, "fecha_fin": "2014-10-23", "detalles": "-", "ciudad": "CASTELL\u00d3N DE LA PLANA", "fecha_inicio": "2014-10-20", "nombre": "FERIA ALTERNATIVA"},
{"provincia": 48, "fecha_fin": "2014-10-25", "detalles": "-", "ciudad": "LANESTOSA", "fecha_inicio": "2014-10-25", "nombre": "FERIA AGROALIMENTARIA"},
{"provincia": 20, "fecha_fin": "2014-10-25", "detalles": "-", "ciudad": "TOLOSA", "fecha_inicio": "2014-10-25", "nombre": "OTROS"},
{"provincia": 20, "fecha_fin": "2014-10-25", "detalles": "-", "ciudad": "IDIAZABAL", "fecha_inicio": "2014-10-25", "nombre": "FERIA ALIMENTACION"},
{"provincia": 7, "fecha_fin": "2014-10-26", "detalles": "-", "ciudad": "PALMA DE MALLORCA", "fecha_inicio": "2014-05-04", "nombre": "FERIA AGROALIMENTARIA"},
{"provincia": 33, "fecha_fin": "2014-10-26", "detalles": "-", "ciudad": "AVIL\u00c9S", "fecha_inicio": "2014-10-10", "nombre": "FERIA DE ARTESAN\u00cdA"},
{"provincia": 2, "fecha_fin": "2014-10-26", "detalles": "-", "ciudad": "HELLIN", "fecha_inicio": "2