Skip to content

Instantly share code, notes, and snippets.

View rotten77's full-sized avatar

Jan Zatloukal rotten77

View GitHub Profile
@rotten77
rotten77 / google-analytics.txt
Created December 31, 2012 09:34
Aby nedocházelo k indexování duplicitního obsahu při použití měřícího odkazu s parametrem (např. .../?utm_source=zdroj&utm_medium=medium&utm_campaign=nazev) použijeme místo otazníku ? křížek #. Je nutné pro to ale upravit Google Analytics měřící kód a pro případ, že se někde objeví měřící odkaz s parametrem, také přesměrování pomocí .htaccess
Do JS kódu:
_gaq.push(['_setAllowAnchor', true]);
Do .htaccess:
RewriteCond %{QUERY_STRING} ^(utm_.*)$
RewriteRule ^(.*)$ /$1#%1? [R=301,NE,L]
RewriteCond %{QUERY_STRING} ^(.*?)&(utm_.*)$
RewriteRule ^(.*)$ /$1?%1#%2 [R=301,NE,L]
@rotten77
rotten77 / chrome-nanny-allow.js
Created April 18, 2013 06:42
Snippet allow code for "Nanny for Chrome" extension
document.getElementById('userEnteredText').value = document.getElementById('origText').value;
@rotten77
rotten77 / check-all.js
Created May 2, 2013 07:54
Check all checkboxes
var checkboxes = new Array();
checkboxes = document.getElementsByTagName('input');
for (var i=0; i<checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox') {
checkboxes[i].checked = true;
}
}
@rotten77
rotten77 / google-keep-bookmarklet.js
Created May 3, 2013 06:57
Google Keep Bookmarklet
javascript:void(function(){var w = 430; var h = 600; var t = (screen.height ? (screen.height - h) / 4 : 0); var l = (screen.width ? (screen.width - w) / 2 : 0); var win = window.open('https://drive.google.com/keep/','google-keep','width='+w+',height='+h+',top='+t+',left='+l+',location=no,personalbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes');})();
<?php
define('APP_ID', ''); // Your App's ID
define('APP_SECRET', ''); // Your App's Secret
define('PAGE_URN', ''); // http://facebook.com/YOUR_PAGE_URN
define('APP_URL', 'http://'); // Your App's registered domain
/**
* Get acces_token for API
*/
$getToken = 'https://graph.facebook.com/oauth/access_token?client_id=' . APP_ID . '&client_secret=' . APP_SECRET . '&grant_type=client_credentials&redirect_uri=' . APP_URL;
@rotten77
rotten77 / wordpress-change-domain.sql
Created September 11, 2013 17:55
SQL query for change domain on Wordpress blog
UPDATE TABLE wp_options SET option_value = "new domain" WHERE option_name = "siteurl"
UPDATE TABLE wp_options SET option_value = "new domain" WHERE option_name = "home"
@rotten77
rotten77 / shutdown.bat
Created September 16, 2013 09:34
Automatické vypnutí PC po určitém čase
@ECHO off
@CHOICE /T:10 /C:12345s /M "Za jak dlouho vypnout? (1) 1 hod, (2) 20 minut, (3) 10 minut, (4) 5 minut, (5) hned, (s) zrusit" /D:1
IF ERRORLEVEL 6 GOTO zero
IF ERRORLEVEL 5 GOTO five
IF ERRORLEVEL 4 GOTO four
IF ERRORLEVEL 3 GOTO three
IF ERRORLEVEL 2 GOTO two
IF ERRORLEVEL 1 GOTO one
GOTO end
:zero
<?php
/**
* Translates a number to a short alhanumeric version
*
* Translated any number up to 9007199254740992
* to a shorter version in letters e.g.:
* 9007199254740989 --> PpQXn7COf
*
* specifiying the second argument true, it will
* translate back e.g.:
@rotten77
rotten77 / bootstrap3-mq.css
Created July 11, 2014 13:31
Bootstrap 3 - Media queries breakpoints
/* Extra small devices (no-need) */
@media (max-width: 767px) {
}
/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
}
@rotten77
rotten77 / getRepeatingString.php
Last active August 29, 2015 14:04
Get repeating strings in PHP array
<?php
/**
* ===========================================
* Compare strings and return repeating string
* ===========================================
*
* EXAMPLE:
*
* $strings = array(
* "oh this is repeating string number one",