Skip to content

Instantly share code, notes, and snippets.

@Sinewyk
Sinewyk / serialize.js
Created March 12, 2024 18:43
serialize from form element
/**
* Serialize values from a DOMNode (should probably be an input)
* @param {DOMNode} el The element you want to serialize
* @return {object} The couple { object, value } of the serialized field
*
* @note Needs an Array.from es6 polyfill
* because of destructuring of NodeList DOM stuff
*/
export function serializeValueFromDOMNode(/* HTMLFormElement */ el) {
const name = el.name;
@Sinewyk
Sinewyk / gist:3321dc4eefa042cbb6021218f7adc869
Created March 11, 2020 16:28
Fuck gnome move workspace up & down for visual code copy line up & down
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-down "['']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-up "['']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "['']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "['']"
https://start.duckduckgo.com/?q=%s&kak=-1&kal=-1&kao=-1&kaq=-1&kp=-2&kz=-1&kav=1&kn=1&k1=-1&kaj=m&kax=-1&kap=-1&kau=-1&kba=-1&kae=d&ks=l&kw=s&km=m&ia=web
@Sinewyk
Sinewyk / withState.ts
Last active March 23, 2019 18:09
diff @cycle/state
diff --git a/state/src/withState.ts b/state/src/withState.ts
index 030084c1..aa91388f 100644
--- a/state/src/withState.ts
+++ b/state/src/withState.ts
@@ -39,11 +39,13 @@ export function withState<
xs.fromObservable<Reducer<T>>(sinks[name]),
xs.never()
);
- stream$.subscribe({
- next: i => schedule(() => reducerMimic$._n(i)),
@Sinewyk
Sinewyk / userChrome.css
Created November 14, 2017 19:42
Hide tab bar top of FF 57
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
#TabsToolbar { visibility: collapse; }
@Sinewyk
Sinewyk / myBug.js
Last active June 18, 2017 13:30
I'm missing something in how to fix this ...
import { just, iterate } from 'most';
const inputString = 'initial';
just(inputString)
.tap(x => console.log(`my initial string ${x}`))
.chain(() => iterate(x => x + 1, 1))
.tap(x => console.log(`generated chapter url ${x}`))
.take(4) // If I remove this line, I get the requests starting, but then I get stuck in an infinite loop of generated chapters url
.map(x => {
const set = [0, 1, 2];
const retry = n => stream => stream.recoverWith(e => n === 0 ? most.throwError(e) : retry(n - 1, stream));
let i = 0;
most.from(set)
.tap(x => {
if (i === 0 && x === 2)
{
i++;
#!/bin/bash
apt-get update
apt-get install bind9
cat <<EOF > /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
forwarders {
8.8.8.8;
8.8.4.4;
const log = (scope, item) => () => console.log(`${item} of ${scope}`);
const dummy = () => {};
describe('Outer scope', function() {
before(log(this.title, 'before'));
beforeEach(log(this.title, 'beforeEach'));
afterEach(log(this.title, 'afterEach'));
@Sinewyk
Sinewyk / connectToI18n.js
Created March 21, 2016 10:01
from mixin to HoC for i18n
const path = require('path');
const printOptions = {
quote: 'single',
trailingComma: true,
};
const I18N_MIXIN = 'i18nMixin';
const I18N_MIXIN_FILE = 'mixins/i18n';
const CONNECT_TO_I18N = 'connectToI18n';