Skip to content

Instantly share code, notes, and snippets.

<?php
define('HASH', 'BestRandomHashEver');
$erro = $ok = '';
if (empty($_POST['usuario']) || empty($_POST['contrasinal'])) {
$erro = 'Sentímolo, os datos enviados non son correctos';
return false;
}
<?php
define('HASH', 'BestRandomHashEver');
$erro = $ok = '';
if (empty($_POST['usuario']) || empty($_POST['contrasinal'])) {
$erro = 'Sentímolo, os datos enviados non son correctos';
return false;
}
<?php
$urls = array(
'http://google.com/',
'https://google.com/',
'https://google.com?q=Google',
'https://google.com/search?q=Google',
'https://google.com/search/?q=Google&limit=10',
'https://google.com/search/?q=Google#results',
);
<?php
Interface iDB
{
public function __construct ($opcions);
public function gardar ($chave, $valor);
public function recuperar ($chave);
public function borrar ($chave);
public function existe ($chave);
}
<?php
define('HASH', 'BestRandomHashEver');
$erro = $ok = '';
if (empty($_POST['usuario']) || empty($_POST['contrasinal'])) {
$erro = 'Sentímolo, os datos enviados non son correctos';
return false;
}
#!/bin/bash
url=$1
if [ "`echo $url | grep 'flickr.com'`" == '' ]; then
echo ''
echo 'This url seems not to be a flickr url ('$url')'
echo ''
exit 1
// Usage <button type="button" data-print=".section-to-print">Print</button>
(function ($) {
'use strict';
$('[data-print]').on('click', function (e) {
e.preventDefault();
var $this = $(this),
$print = $($this.data('print'));
@eusonlito
eusonlito / merge-xls2csv.sh
Last active August 29, 2015 14:14
Merge multiple XLS to a new CSV file from command line
#!/bin/bash
HEADER_START='ALL_HEADERS_START_WITH_THIS'
DELETE_PREVIOUS_CSV=true
FILE='merged-xls.csv'
if [ "$DELETE_PREVIOUS_CSV" == "true" ]; then
rm -f *.csv
fi
#!/bin/bash
download=$(wget -q https://about.gitlab.com/downloads/ -O - | grep -oh 'https://downloads-packages.s3.amazonaws.com/ubuntu-14.04.*\.deb')
deb=$(basename "$download")
if [ -f "$deb" ]; then
echo ''
echo 'No updates. Last update deb is '$deb
echo ''
@eusonlito
eusonlito / composer
Created April 6, 2015 11:38
Update composer on each request. "composer" and "composer.phar" installed on /usr/local/bin/
#!/bin/sh
composer.phar self-update > /dev/null 2> /dev/null
composer.phar "$@"
exit 0