Skip to content

Instantly share code, notes, and snippets.

View rix1's full-sized avatar
🕵️
Googling how to help co-workers

rix1 rix1

🕵️
Googling how to help co-workers
View GitHub Profile
@rix1
rix1 / client_api.js
Last active October 27, 2023 08:35
Code understanding. Read through and think out loud: What does this code do? How would you change it? Feel free to use your editor.
export const request = ({ method, url, content }) => {
if (content && method === 'GET') {
throw new Error('GET method with content is not supported');
}
if (
!appGlobalsService.get('NODE_ENV') === 'development' &&
typeof navigator !== 'undefined' &&
!!navigator &&
navigator.onLine === false
@rix1
rix1 / intro.md
Last active October 27, 2023 09:12 — forked from kmkr/surfaces.py
Surface code (refactoring)

Context

You come across this patch as a pull request. It's only green lines (additions) with the following commit message.

commit 2f159dcef7412a88175debfef54d317a162c1999 (HEAD -> origin/bobby-dev/add-surface-api)
Author: Bobby Developer <bobby-dev@otovo.com>
Date:   Fri Apr 14 11:46:01 2023 +0200
 
    Surfaces: Start fetching surfaces from external service
tests = [["ABAZDC", "BACBAD"], ["AA", "AAAA"], ["AGGTAB", "GXTXAYB"]];
function findCommon(a, b) {
arrB = [...b];
return [...a].filter((c, index) => {
if (!arrB.includes(c)) {
return false;
}
const match = arrB.indexOf(c, Math.min(index, arrB.length - 1));
@rix1
rix1 / pf.js
Last active April 8, 2019 07:01
/*
Introducing `f` – a simple formatter for complex strings
optimized for readability, inspired by Python's printf
✅ No need for new variable names
✅ Readable code
✅ Readable result string
*/
// Usage
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

In spite of no Remarkable-battery, I've started documenting the process ✌️Along the way this actually took the form of a blog post (dev-blog any1??1 😄). First part «Build and Server Stuff» is kinda ready for review/feedback if anyone is interested in reading 📖. I'll supplement with Client side stuff later. Tomorrow probably.

Before we decide where this should reside (docs/blog idunno ¯\_(ツ)_/¯ ) I'll just post it here as a comment.


Build phase

Babel

@rix1
rix1 / eksempel.html
Last active May 15, 2018 15:43
Elgiganten iframe widget
<!DOCTYPE html>
<html>
<head></head>
<body>
<div class=">
<iframe
width="100%"
height="250px"
frameborder="0"
src="https://api.otovo.com/widgets/leads/?country=se&partner=elgiganten"

Keybase proof

I hereby claim:

  • I am rix1 on github.
  • I am rix1 (https://keybase.io/rix1) on keybase.
  • I have a public key ASAIp4xxxENxQHlu6F9Pzn9L891e9SwSYMYzLwx7icPlpAo

To claim this, I am signing this object: