Skip to content

Instantly share code, notes, and snippets.

@garcon
garcon / In-browserTextEditor.txt
Last active August 28, 2025 09:09
Paste the code into the browser’s address bar, then save it as a bookmark. You’ll get a Notepad-like text editor. Keep in mind, your text gets lost when you close the window!
data:text/html;charset=utf-8,%3Ctitle%3ETextEditor%3C/title%3E%3Cstyle%3Ebody%7Bbackground:%23fbfbfb;color:%23333;margin:0%20auto;width:50rem%7Dtextarea%7Bbackground:%23fbfbfb;border:0;color:%23333;font-family:sans-serif;font-size:2rem;height:98%25;line-height:1.4;margin:0%20auto;outline:0;padding:4rem;width:100%25%7Dbutton%7Bbackground-color:%23fbfbfb;border:1px%20%23ccc%20solid;color:%23999;cursor:pointer;float:right;margin:10px%200;padding:5px%2010px%7D@media%20(max-width:768px)%7Bbody%7Bwidth:100%25;padding:0%7Dtextarea%7Bpadding:10px%7Dbutton%7Bfloat:none%7D%7D%3C/style%3E%3Cbody%3E%3Cbutton%20onclick=%22sM();%20return%20false%22%3EEmail%20this%3C/button%3E%3Ctextarea%20contenteditable%20id=TE%20spellcheck=false%20placeholder=Write...%20autofocus%3E%3C/textarea%3E%3Cscript%3Efunction%20sM()%7Bvar%20a=%22mailto:?subject=%22+escape(%22Text%20from%20TextEditor%22)+%22&body=%22+escape(document.getElementById(%22TE%22).value);window.location.href=a%7D;%3C/script%3E
@garcon
garcon / bin.json
Last active May 23, 2025 11:36
Wishlist
{
"wishlist": [
{
"title": "Let na Měsíc",
"url": "https://www.spacex.com/",
"image": "https://picsum.photos/300/200?random=1",
"price": "500000000000 Kč",
"reserved_by": null
},
{
@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