Skip to content

Instantly share code, notes, and snippets.

View konsalex's full-sized avatar
👨‍🔬
Building Graph-ical Interfaces

Costa Alexoglou konsalex

👨‍🔬
Building Graph-ical Interfaces
View GitHub Profile
@konsalex
konsalex / slackFavicon.js
Created April 29, 2022 09:12
Slack Notification Favicon removal 😌
// The default "no notifications" icon of Slack on web
const simpleFavicon =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAFyklEQVR4nO2bPXMTVxiFz3tlyySFspqBTCiAVefGQi7CDAFnrBYmweoIjfUPLHcUEEuBIl3kX4BVBNNJDhmczkqRDzCFMBR0XgwzyWTMeCEzmcH27kkhY4y1kvZaV/5I/My4uffq7LtntOu7Z18JDJOaW7H7+tQYyWEAFgUOfc6sr6FSS8edMBr9s1ftKKKj8P0RiFgEHAFmVt+sVZ5mvg2lERYxKXbml1cTAPNNph0RTt7/LF5spZH86esx+Gy2xgVQWLhwo6WGDsYMaHPy71Aq++BsrBQ0lZy9NgFKew1g3JQJRgxIza3Y0agshlzurq4yUUvH3a2D/bNX7Sh7Q2uoN38napmi23ZlG1SnAgDQF1UTGsutvl5ktw/2oldLw4/Gchrrm2LEAJIprfWC4e1j4ouWBpTeMZvKmBCBIKWznCIfNWponhBxWmt9E8wYADiGdHYdIwYIUDOhsxcYMcDzOWlCZy8wYsDDoXiVB9QEU/cAzA/FcwfRBGMGABsmgIMgSyBqqN8cG/6kvqXdF/SYFpw/F68BjRud/YrRb8BB5NCAvS5gr3nvHpCaW7GjR9QoyBSot71tgkuBC7K0topq2EDEBHY5Z8WOxMZIpoS0KeIGhSqbj8Of/vpqTNg0iDCBA4/jDz6PV4Imk/euU1dv4cKNRKBWPVTJA7ACpl1sCVUUUA8zunzyAGAjIuUzv70e7eZBkrPXJjYSJavJEgvAd8l713MAoFJzK3aoJMcUvl9Mza1Y3ZDun71qh0yUAGAiVc5ZSjPMMEFgIGKCnYQqygdHulFMK4ICERPsJFRR0vxa6RqBgYi+itswJLT0JHBacf/syx2dxYS4nR6QgKMUdz/MUD5nAsr5WUdDyE
@adam-cowley
adam-cowley / all.cypher
Last active June 11, 2021 10:15
Euro 2020 in Neo4j
:begin
CREATE INDEX ON :Fixture(kickoff);
CREATE CONSTRAINT ON (node:Country) ASSERT (node.id) IS UNIQUE;
CREATE CONSTRAINT ON (node:Fixture) ASSERT (node.id) IS UNIQUE;
CREATE CONSTRAINT ON (node:Group) ASSERT (node.id) IS UNIQUE;
CREATE CONSTRAINT ON (node:Player) ASSERT (node.id) IS UNIQUE;
CREATE CONSTRAINT ON (node:Stadium) ASSERT (node.name) IS UNIQUE;
CREATE CONSTRAINT ON (node:`UNIQUE IMPORT LABEL`) ASSERT (node.`UNIQUE IMPORT ID`) IS UNIQUE;
:commit
CALL db.awaitIndexes(300);
@konsalex
konsalex / fullPageScreenshot.js
Created January 14, 2020 11:38
Puppeteer Full page Screenshot Workaround
function addStyleString(str) {
var node = document.createElement("style");
node.innerHTML = str;
document.body.appendChild(node);
}
const viewportWidth = window.innerWidth;
const viewportHeight = window.innerHeight;
const new_vh = 0.01 * viewportHeight;
const new_vw = 0.01 * viewportWidth;
@bebosudo
bebosudo / django_custom_widget.md
Last active January 25, 2024 02:48
Custom django form widget with no pain.

First of all, edit your_app_settings/settings.py and add:

INSTALLED_APPS = [
    'django.forms',  # to let django discover the built-in widgets
    ...
]

FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
@giannisp
giannisp / gist:1d8dc9a6ed13876c51ccfe9fefcb311e
Created January 13, 2017 09:50
Using lodash from Chrome's dev tools console
# How to make lodash available via "_" on console
var el = document.createElement('script');
el.src = 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.js';
document.getElementsByTagName('head')[0].appendChild(el);
# Use _.VERSION or any other function to verify that it worked
# lodash 4.x version quick link:
https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js
@wojteklu
wojteklu / clean_code.md
Last active May 19, 2024 03:34
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@myouju
myouju / enc_dec.go
Last active April 29, 2024 09:42
encryption - encrypt / decrypt by ruby, python, and golang with AES-256-CFB
package main
import (
"fmt"
"io"
"encoding/base64"
"crypto/rand"
"crypto/cipher"
"crypto/aes"
"crypto/md5"
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@cuth
cuth / debug-scroll.md
Last active February 7, 2024 18:17
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right > w || b.left < 0) {
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real