Skip to content

Instantly share code, notes, and snippets.

View pespantelis's full-sized avatar
🐛

Pantelis Peslis pespantelis

🐛
View GitHub Profile
@pespantelis
pespantelis / php-cs-fixer-hook
Last active January 11, 2019 14:43
PHP-CS-Fixer Git pre commit/push hook
#!/bin/sh
# if the script is running from a terminal, show colors
if [ -t 1 ]; then
STYLE_END="\033[m"
BLUE="\033[34m"
GREEN="\033[32m"
RED="\033[41m"
YELLOW="\033[43m\033[34m"
fi
// https://github.com/davidshimjs/qrcodejs/
Vue.directive('qrcode', function (data) {
Vue.nextTick(() => {
qrcodeOptions.text = typeof data === 'object'
? data.href || data.value || data.text
: data
new QRCode(this.el, qrcodeOptions)
})
import Vue from 'vue'
import Moment from 'moment'
Vue.directive('moment-ago', {
update (timestamp) {
this.el.innerHTML = Moment(timestamp).fromNow()
this.interval = setInterval(() => {
this.el.innerHTML = Moment(timestamp).fromNow()
}, 1000)
@pespantelis
pespantelis / greeklish.php
Last active August 30, 2017 07:54
Greeklish function
<?php
function greeklish($string)
{
$replace_pairs = [
'Α' => 'A',
'Ά' => 'A',
'Β' => 'V',
'Γ' => 'G',