Skip to content

Instantly share code, notes, and snippets.

View jbbn's full-sized avatar
🌮
Typing as fast as I can

João Bueno jbbn

🌮
Typing as fast as I can
View GitHub Profile
@jbbn
jbbn / slugify.js
Last active June 18, 2023 00:45 — forked from codeguy/slugify.js
Create slug from string in #javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâãèéëêìíïîòóöôõùúüûñç·/_,:;";
var to = "aaaaaeeeeiiiiooooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@jbbn
jbbn / tinydump.php
Last active August 29, 2015 14:24 — forked from ceckoslab/tinydump
<?php
define('DS', DIRECTORY_SEPARATOR);
function _getExtractSchemaStatement($sqlFileName, $db)
{
$dumpSchema = 'mysqldump' . ' ';
$dumpSchema .= '--no-data' . ' ';
$dumpSchema .= '-u ' . $db['user'] . ' ';
$db['pass'] = (string) $db['pass'];