Skip to content

Instantly share code, notes, and snippets.

@lvthinh1487
lvthinh1487 / str_slug.js
Last active May 19, 2021 20:20
str_slug js fuction export from laravel framework
function trim(str, charlist) {
// example 1: trim(' Kevin van Zonneveld ')
// returns 1: 'Kevin van Zonneveld'
// example 2: trim('Hello World', 'Hdle')
// returns 2: 'o Wor'
// example 3: trim(16, 1)
// returns 3: '6'
let whitespace = [
' ',
@lvthinh1487
lvthinh1487 / decode_dle.js
Last active December 16, 2018 07:05
Decode DataLife Engine using nodejs + php (tested on DLE 11.2)
const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;
let dlePath = '/path/to/dle';
let index = 0;
let tmpFile = process.cwd() + '/tmp.php';
function readDirRecursively(dir) {
let files = [];
@lvthinh1487
lvthinh1487 / str_slug.php
Last active December 9, 2016 16:54
str_slug fuction export from laravel framework
<?php
if (!function_exists('str_slug')) {
function str_slug($title, $separator = '-')
{
$charsArray = [
'0' => ['°', '₀', '۰'],
'1' => ['¹', '₁', '۱'],
'2' => ['²', '₂', '۲'],
'3' => ['³', '₃', '۳'],
'4' => ['⁴', '₄', '۴', '٤'],