Skip to content

Instantly share code, notes, and snippets.

View cvsolutions's full-sized avatar
😂
Drogato di tecnologia per passione e per lavoro! :)

Concetto Vecchio cvsolutions

😂
Drogato di tecnologia per passione e per lavoro! :)
View GitHub Profile
@cvsolutions
cvsolutions / variables_from_PHP_to_JS
Last active August 29, 2015 14:23
How to pass variables and data from PHP to JavaScript?
<?php define('NAME', 'Pippo'); ?>
<?php $name = NAME; ?>
<script type="javascript">
<?php
echo <<<JS
var name = '{$name}';
alert(name);
JS;
?>
@cvsolutions
cvsolutions / Remove_PHPStorm old folder
Last active July 25, 2019 10:16
Remove PhpStorm2019.1 settings from Mac OS X 10.14.4 Mojave
#!/usr/bin/sh
rm -rf "$HOME/Library/Preferences/PhpStorm2019.1"
rm -rf "$HOME/Library/Caches/PhpStorm2019.1"
rm -rf "$HOME/Library/Application Support/PhpStorm2019.1"
rm -rf "$HOME/Library/Logs/PhpStorm2019.1"
# Add Homebrew `/usr/local/bin` and User `~/bin` to the `$PATH`
# PATH=/usr/local/bin:/Applications/MAMP/bin/php/php7.0.0/bin:/Applications/MAMP/Library/bin:$PATH
PATH=/usr/local/bin:$PATH
PATH=$HOME/bin:$PATH
export PATH
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
# Shamelessly copied from https://github.com/gf3/dotfiles
# Screenshot: http://i.imgur.com/s0Blh.png
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
fi
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi
# List all files colorized in long format
alias ll='ls -lh'
[alias]
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# Pretty log output
hist = log --graph --pretty=format:'%Cred%h%Creset %s%C(yellow)%d%Creset %Cgreen(%cr)%Creset [%an]' --abbrev-commit --date=relative
[color]
# Use colors in Git commands that are capable of colored output when outputting to the terminal
@cvsolutions
cvsolutions / .git-completion.bash
Last active September 24, 2016 13:15
Completion support for core Git.
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@cvsolutions
cvsolutions / atom-setup
Last active April 21, 2017 07:49
Configuration, packages and settings. ⚛️
Packages make Atom do amazing things.
- https://atom.io/packages/sync-settings
- https://atom.io/themes/native-ui
- https://atom.io/packages/file-icons
- https://atom.io/packages/atom-wrap-in-tag
- https://atom.io/packages/var-that-color
- https://atom.io/packages/minimap-cursorline
- https://atom.io/packages/color-picker
@cvsolutions
cvsolutions / GetHourDiff
Created July 2, 2018 13:59
[Javascript] Differenza tra ore hh:mm
function GetHourDiff(pStartHour, pEndHour) {
var res = "";
var aTmp="";
//Trasformo l'orario di inizio in minuti
aTmp=pStartHour.split(":");
var nStartMin = (Number(aTmp[0]) * 60) + Number(aTmp[1]);
//Trasformo l'orario di fine in minuti
aTmp=pEndHour.split(":");
var nEndMin = (Number(aTmp[0]) * 60) + Number(aTmp[1]);
//Calcolo la differenza