Skip to content

Instantly share code, notes, and snippets.

View artf's full-sized avatar
🍇
Building a vineyard

Artur Arseniev artf

🍇
Building a vineyard
View GitHub Profile
import Vue from 'vue';
import Toasted from 'vue-toasted';
import i18n from '@/i18n';
Vue.use(Toasted);
export default {
notify(msg, opts = {}) {
const providerType = opts.provider || 'toast';
const level = opts.level || null;
import axios from 'axios';
import { Notifier } from '@/plugins/notifier';
import isString from 'lodash/isString';
import jwtDecode from 'jwt-decode';
import router from '@/router';
const routeBackToKey = 'routeBackTo';
const tokenUpdateEndpoint = 'token/refresh';
# Color functions
function RED { echo -e "\e[91m$1\e[0m"; }
function DARK_RED { echo -e "\e[31m$1\e[0m"; }
function YELLOW { echo -e "\e[93m$1\e[0m"; }
function DARK_YELLOW { echo -e "\e[33m$1\e[0m"; }
function GREEN { echo -e "\e[92m$1\e[0m"; }
function DARK_GREEN { echo -e "\e[32m$1\e[0m"; }
function CYAN { echo -e "\e[96m$1\e[0m"; }
function DARK_CYAN { echo -e "\e[36m$1\e[0m"; }
function BLUE { echo -e "\e[94m$1\e[0m"; }
@artf
artf / post-receive.sh
Created May 15, 2017 09:54
Simple git deploy based on branch
#!/bin/bash
workPath="/var/www/"
gitPath="/var/www/repos/reponame.git"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "production" == "$branch" ]; then
git --work-tree="${workPath}production" --git-dir="${gitPath}" checkout -f $branch
@artf
artf / orderObjects.php
Created November 10, 2016 15:09
Order array of objects
<?php
usort($aObjects, function($a, $b) {
$a = $a->getDate();
$b = $b->getDate();
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
});
@artf
artf / cities.sql
Created November 6, 2016 14:11
Database of countries and cities
This file has been truncated, but you can view the full file.
-- phpMyAdmin SQL Dump
-- version 4.3.13
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 06, 2016 at 03:06 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.36
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@artf
artf / regions.sql
Last active November 6, 2016 14:07
Database of countries and cities
-- phpMyAdmin SQL Dump
-- version 4.3.13
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 06, 2016 at 03:03 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.36
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@artf
artf / countries.sql
Created November 6, 2016 14:04
Database of countries and cities
-- phpMyAdmin SQL Dump
-- version 4.3.13
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 06, 2016 at 02:58 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.36
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@artf
artf / uri-parser.js
Created November 3, 2016 13:32
Quick uri parsing in browser
/**
* Parse uri
* @param {string} uri
* @return {object}
*/
var parseUri = function(uri) {
var el = document.createElement('a');
el.href = uri;
var query = {};
var qrs = el.search.substring(1).split('&');