Skip to content

Instantly share code, notes, and snippets.

@garcon
garcon / seo-slug.php
Last active April 13, 2022 10:48
Change any string into SEO friendly URL slug
<?php
// example code
setlocale(LC_CTYPE, 'cs_CZ');
$str = "Běloučký kůň úpěl ďábelské ódy $ ' 1234";
print
preg_replace('/(?<=-)-+/', '', // Replace all duplicase hyphens with one only
preg_replace( '/[^-a-z0-9]/', '', // Strip all non-alfanumeric characters or hyphens
@garcon
garcon / fullScreen.js
Created April 23, 2021 15:53
Run browser in full screen mode
// JavaScript
document.getElementsByTagName("html")[0].webkitRequestFullScreen();
// document.getElementsByTagName("html")[0].requestFullscreen();
// document.getElementsByTagName("html")[0].msRequestFullscreen();
# OCR PDF file
ocrmypdf -l ces input.pdf output.pdf
# -l => language: -l eng+deu, -l ces
# --sidecar => Generate text files that contain the same text recognized by OCR
# --title TITLE => Set document title (place multiple words in quotes)
# --author AUTHOR => Set document author
# --subject SUBJECT => Set document subject description
# --keywords KEYWORDS => Set document keywords
@garcon
garcon / audio-video-manipulation.md
Last active February 18, 2022 08:04
This is a collection of command line one-liners for manipulating with audio and video files
@garcon
garcon / jquery.textchange.js
Created November 9, 2010 15:19 — forked from mkelly12/jquery.textchange.js
jQuery Text Change Event
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
@garcon
garcon / query-string-parser.js
Created October 6, 2010 21:17
Javascript Query String Parser
function ptq(q)
{
/* parse the query */
/* semicolons are nonstandard but we accept them */
var x = q.replace(/;/g, '&').split('&'), i, name, t;
/* q changes from string version of query to object */
for (q={}, i=0; i<x.length; i++)
{
t = x[i].split('=', 2);
name = unescape(t[0]);
@garcon
garcon / DeliciousGoogle.user.js
Created June 13, 2010 21:40
Delicious search results on Google
// ==UserScript==
// @name Delicious Search Results on Google
// @namespace gaillard
// @description Shows results from Delicious on Google search pages
// @include http://www.google.*/search*
// @date 2009-03-07
// @version 0.1
// @GM_version 0.8.20080609.0
//
// 99% of the code for this user script comes form markcarey's userscript 'Twitter Search Results on Google' (http://userscripts.org/scripts/show/43451)
mysql -u username -p -h localhost data-base-name < data.sql
// http://interval.cz/clanky/pokrocile-zpracovani-udalosti-napric-platformami/
var events = new Object();
events.addListener = function(element,type,fcn)
{
if (!element.addEventListener && !element.attachEvent) return false;
if (element.addEventListener) element.addEventListener(type,fcn,false);
else if (element.attachEvent)
{
<?php
//
// This compiler is currently in beta status.
// The code is quick and dirty, but it works as far as I know.
// Feedback welcome:
// http://arantius.com/contact.php
//
// Released under GPLv2 license.
//