Skip to content

Instantly share code, notes, and snippets.

View honsa's full-sized avatar
💭
I am just a human

honsa.ch honsa

💭
I am just a human
View GitHub Profile
@honsa
honsa / install-chrome-headless.sh
Created August 26, 2020 12:44 — forked from ipepe/install-chrome-headless.sh
Installing headless chrome on Ubuntu.
#!/bin/bash
# from https://chromium.woolyss.com/
# and https://gist.github.com/addyosmani/5336747
# and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser
chromium-browser --headless --no-sandbox http://example.org/
@honsa
honsa / native_js_drag_and_drop_helper.js
Created August 18, 2020 13:18 — forked from druska/native_js_drag_and_drop_helper.js
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)
@honsa
honsa / Saitek X52 Pro Flight Control System - Windows.joy
Created April 18, 2020 10:26 — forked from rafaelmartins/Saitek X52 Pro Flight Control System - Windows.joy
Saitek X52 Pro settings for X-Plane 11 (Windows) - Just download this file to 'X-Plane 11/Resources/joystick configs'
I
1100 version
JOY
OS: Windows
Name: Saitek X52 Pro Flight Control System
Display: Saitek X52 Pro
Assignments:
--------------------------------------------------------------
@honsa
honsa / xampp_php7_xdebug.md
Created March 1, 2019 08:58 — forked from odan/xampp_php7_xdebug.md
Installing Xdebug for XAMPP

Installing Xdebug for XAMPP with PHP 7.x

Requirements

Setup

@honsa
honsa / js-observables-binding.md
Created February 7, 2019 19:52 — forked from austinhyde/js-observables-binding.md
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);

@honsa
honsa / chat-frontend.js
Created November 22, 2018 20:08 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@honsa
honsa / wallabag_auto_tag_rule-trigger.mysql
Last active October 2, 2018 18:33
Automaticly create rules for new tags in wallabag MySQL database. Search in title and content for keyword and trigger wallabag_tagging_rule insert with this keyword.
BEGIN
SET @tag = NEW.slug;
If length(@tag) >= 3 THEN
SET @ruleTitle = CONCAT('title matches " ', @tag,' "');
SET @ruleContent = CONCAT('content matches " ',@tag,' "');
INSERT INTO wallabag_tagging_rule (config_id,rule,tags) VALUES (1,@ruleTitle, @tag);
INSERT INTO wallabag_tagging_rule (config_id,rule,tags) VALUES (1,@ruleContent, @tag);
END IF;
END
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA
@honsa
honsa / animatedScrollTo.js
Created September 12, 2018 08:18 — forked from joshbeckman/animatedScrollTo.js
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@honsa
honsa / IntersectionObserver.js
Last active October 2, 2018 18:37
Simple example implementation of the famous javascript intersection observer.
let element = document.querySelector('.element');
observer = new IntersectionObserver(callback);
observer.observe(element);
function callback(entry, observer){
if(entry[0].isIntersecting){
console.log(entry[0]);
}