Skip to content

Instantly share code, notes, and snippets.

View chrishaensel's full-sized avatar

Christian Hänsel chrishaensel

View GitHub Profile
@chrishaensel
chrishaensel / checkTitles.js
Created September 3, 2021 05:57 — forked from fedegomez/checkTitles.js
Checks if the title of the result in the SERP matches the title of the URL
javascript: (function (doc){var changed=0; function checkTitles(){console.log('jQuery version ', $.fn.jquery, ' loaded'); var position=1; var items=[]; var results=$('#rso .kp-blk .g, #rso .g[class="g"], #rso .srg .g').not('.kno-kp .g').find('div:first').find('a:first'); $('.title-changed, #CountTitlesChanged').remove(); results.each(function (){if (!$(this).parents('.related-question-pair').length){var parent=$(this).closest('.tF2Cxc').length > 0 ? $(this).closest('.tF2Cxc') : $(this).closest('li'); items.push([ position, $(this).find('h3').text(), encodeURI($(this).attr('href')), parent]); position++;}}); var numItems=1; cors_proxies=[ 'https://api.codetabs.com/v1/proxy?quest=', 'https://jsonp.afeld.me/?url=',]; items.forEach(item=>{$.ajax({url: cors_proxies[Math.floor(Math.random() * cors_proxies.length)] + item[2], success: function (data, status, xhr){title=$(data).filter('title').text(); var html='<div class="title-changed">'; if (title !=item[1]){html +='<span style="font-weight: bold;color: #ff6961;">
@chrishaensel
chrishaensel / swipe.js
Created February 13, 2018 12:40
Simple swipe gesture recognizer in vanilla javascript
var swiper = {
touchStartX: 0,
touchEndX: 0,
minSwipePixels: 30,
detectionZone: undefined,
swiperCallback: function() {},
init: function (detectionZone, callback) {
swiper.swiperCallback = callback
@chrishaensel
chrishaensel / gist:a80f8b91d76809a2cdd34facc5ef878f
Created November 7, 2019 20:17 — forked from joshhartman/randomPassword.php
Human Readable Password Generator
<?php
function randomPassword( $len = 8, $ucfirst = false, $spchar = false ){
/* Programmed by Christian Haensel
* christian@chftp.com
* http://www.chftp.com
*
* Exclusively published on weberdev.com.
* If you like my scripts, please let me know or link to me.
* You may copy, redistribute, change and alter my scripts as
* long as this information remains intact.
Rang Name 1970 1980 1990 2000 2010 2014 Bundesland
1. Berlin 3.208.719 3.048.759 3.433.695 3.382.169 3.460.725 3.469.849 Berlin
2. Hamburg 1.793.640 1.645.095 1.652.363 1.715.392 1.786.448 1.762.791 Hamburg
3. München 1.311.978 1.298.941 1.229.026 1.210.223 1.353.186 1.429.584 Bayern
4. Köln 849.451 976.694 953.551 962.884 1.007.119 1.046.680 Nordrhein-Westfalen
5. Frankfurt am Main 666.179 629.375 644.865 646.550 679.664 717.624 Hessen
6. Stuttgart 634.202 580.648 579.988 583.874 606.588 612.441 Baden-Württemberg
7. Düsseldorf 660.963 590.479 575.794 569.364 588.735 604.527 Nordrhein-Westfalen
8. Dortmund 640.642 608.297 599.055 588.994 580.444 580.511 Nordrhein-Westfalen
9. Essen 696.419 647.643 626.973 595.243 574.635 573.784 Nordrhein-Westfalen
<?php
/**
* Generate a random human-readable passwort
* Including the modifications by Josh Hartman made on 12/30/2010. https://github.com/joshhartman
* Josh added the ability to append a double digit number
* I added a parameter to decide on whether to append the number
*
* Also, if the length is not dividable by 2, the length of the password will be $length + 1
*
* @param int $length