Skip to content

Instantly share code, notes, and snippets.

View jordi-pascual's full-sized avatar
:octocat:

Jordi Pascual jordi-pascual

:octocat:
  • Spain,Barcelona
View GitHub Profile
@jordi-pascual
jordi-pascual / size_table_database.sql
Last active April 15, 2019 11:37
size_tables_in_database
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "DB_NAME"
ORDER BY (data_length + index_length) DESC;
@jordi-pascual
jordi-pascual / permutation.php
Created October 20, 2017 16:37
Permutation
function pc_permute($items, $perms = array( )) {
if (empty($items)) {
print join(' ', $perms) . "\n";
} else {
for ($i = count($items) - 1; $i >= 0; --$i) {
$newitems = $items;
$newperms = $perms;
list($foo) = array_splice($newitems, $i, 1);
array_unshift($newperms, $foo);
pc_permute($newitems, $newperms);
@jordi-pascual
jordi-pascual / php.nanorc
Created August 9, 2017 23:00
php.nanorc
## PHP Syntax Highlighting
syntax "php" "\.php[2345s~]?$"
# color red ".*"
color red "."
color white start="<\?(php|=)?" end="\?>"
# Numbers
color magenta "[+-]*([0-9]\.)*[0-9]+([eE][+-]?([0-9]\.)*[0-9])*"
color magenta "0x[0-9a-zA-Z]*"
# Functions
color brightblue "([a-zA-Z0-9_$-]*)\("
@jordi-pascual
jordi-pascual / Entity.php
Last active May 26, 2017 14:27
Spanish entities banks - Name and Swift/BIC-
<?php
class Entity
{
public function getEntity($iban){
$entity = substr($iban, 4, 4);
$bics = array(
"0003" => "BDEPESM1XXX", // BANCO DE DEPOSITOS
"0004" => "BANDESSSXXX", // BANCO DE ANDALUCIA
"0011" => "ALLFESMMXXX", // ALLFUNDS BANK
"0015" => "CATAESBBXXX", // BANCA CATALANA
@jordi-pascual
jordi-pascual / GetDniCCC.sh
Created October 3, 2016 07:06
Get DNI and CCC
#!/bin/bash
CURL='/usr/bin/curl'
RED='\033[0;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Get DNI
RVMHTTP="http://www.genware.es/xGenDoc.php"
@jordi-pascual
jordi-pascual / slack_notification.php
Created April 22, 2016 14:08 — forked from alexstone/slack_notification.php
Fire a Slack Notification via CURL
<?php
// (string) $message - message to be passed to Slack
// (string) $room - room in which to write the message, too
// (string) $icon - You can set up custom emoji icons to use with each message
public static function slack($message, $room = "engineering", $icon = ":longbox:") {
$room = ($room) ? $room : "engineering";
$data = "payload=" . json_encode(array(
"channel" => "#{$room}",
"text" => $message,
@jordi-pascual
jordi-pascual / cURL_query.php
Last active August 16, 2022 14:56
cURL_query
<?php
function curl_getQuery($url,$fields)
{
$fields_string = "";
foreach ($fields as $key => $value) {
$fields_string .= $key . '=' . $value . '&';
}
rtrim($fields_string, '&');
@jordi-pascual
jordi-pascual / Operaciones-Git
Created February 12, 2016 09:07 — forked from jelcaf/Operaciones-Git
Git Tips - Mini-trucos de Git para facilitarme la tarea
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas