Skip to content

Instantly share code, notes, and snippets.

View entrevista-programador-exercicio2.php
<?php
Interface iDB
{
public function __construct ($opcions);
public function gardar ($chave, $valor);
public function recuperar ($chave);
public function borrar ($chave);
public function existe ($chave);
}
View entrevista-programador-exercicio3-alta.php
<?php
define('HASH', 'BestRandomHashEver');
$erro = $ok = '';
if (empty($_POST['usuario']) || empty($_POST['contrasinal'])) {
$erro = 'Sentímolo, os datos enviados non son correctos';
return false;
}
View entrevista-programador-exercicio3-acceso.php
<?php
define('HASH', 'BestRandomHashEver');
$erro = $ok = '';
if (empty($_POST['usuario']) || empty($_POST['contrasinal'])) {
$erro = 'Sentímolo, os datos enviados non son correctos';
return false;
}
View acceso.php
<?php
define('HASH', 'BestRandomHashEver');
$erro = $ok = '';
if (empty($_POST['usuario']) || empty($_POST['contrasinal'])) {
$erro = 'Sentímolo, os datos enviados non son correctos';
return false;
}
View flickr-downloader.sh
#!/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
View print-section.js
// 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'));
View install-server-apache-php-mysql.sh
#!/bin/bash
if [ "`whoami`" != 'root' ]; then
echo ""
echo "This script only can be executed by root"
echo ""
exit 1
fi
@eusonlito
eusonlito / merge-xls2csv.sh
Last active Aug 29, 2015
Merge multiple XLS to a new CSV file from command line
View merge-xls2csv.sh
#!/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
View gitlab-upgrade.sh
#!/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 Apr 6, 2015
Update composer on each request. "composer" and "composer.phar" installed on /usr/local/bin/
View composer
#!/bin/sh
composer.phar self-update > /dev/null 2> /dev/null
composer.phar "$@"
exit 0