Skip to content

Instantly share code, notes, and snippets.

@avebers
avebers / json_clean_decode.php
Created December 10, 2018 14:21
Clean comments of json content and decode it with json_decode(). Work like the original php json_decode() function with the same params. Support comments like /* */ and //
<?php
/**
* Clean comments of json content and decode it with json_decode().
* Work like the original php json_decode() function with the same params
*
* @param string $json The json string being decoded
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays.
* @param integer $depth User specified recursion depth. (>=5.3)
* @param integer $options Bitmask of JSON decode options. (>=5.4)
* @return array/object
@avebers
avebers / func.php
Created November 19, 2018 16:26 — forked from ooooak/func.php
laravel bcrypt function
<?php
function bcrypt($password)
{
$hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 10]);
if ($hash === false)
{
throw new RuntimeException('Bcrypt hashing not supported.');
}
@avebers
avebers / gist:597e7cad4480180a572830ec92be0e3a
Created August 19, 2018 13:02 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@avebers
avebers / Template Freeswitch.xml
Created June 5, 2018 15:59 — forked from crashdump/Template Freeswitch.xml
Freeswitch - Zabbix Monitoring
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-12-04T16:01:36Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
@avebers
avebers / .bash
Created March 26, 2018 10:31
Permissions for new Laravel app
## create user group
sudo groupadd laravel
## add composer user to group
sudo gpasswd -a composer-user laravel
## add web server to group
sudo gpasswd -a apache laravel
## jump to laravel path
@avebers
avebers / .sql
Created March 7, 2018 07:38
All Countries SQL insert
CREATE TABLE `countries` (
`id` int(11) NOT NULL auto_increment,
`code` varchar(2) NOT NULL default '',
`title` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
--
-- Dumping data for table `countries`
--
INSERT INTO `countries` VALUES (null, 'AF', 'Afghanistan');
@avebers
avebers / gist:f9e37f7132942c2e6103116fad4376f9
Created February 16, 2018 07:57
SublimeText find emails regex
([a-zA-Z0-9\._-]+@[A-Za-z0-9_-]+?\.[A-Za-z.]{2,16})