Skip to content

Instantly share code, notes, and snippets.

View seriousManual's full-sized avatar
🐷
stuff

Manuel Ernst seriousManual

🐷
stuff
View GitHub Profile
<script type="ts">
import onClickOutside from '../clickOutside'
</script>
<div use:onClickOutside={() => console.log('click')}>
modal
</div>
<script>
import MyButton from './button.svelte'
</script>
<div>
<MyButton />
<MyButton />
<MyButton />
<MyButton />
</div>
@seriousManual
seriousManual / no-redux-plz.js
Last active April 17, 2020 08:34
simple add-hoc react state managment
import { Emitter } from 'events'
import React from 'react'
function createInstance() {
const globalAppState = {
foo: 'bar',
spam: 'eggs'
}
###-begin-npm-completion-###
#
# npm command completion script
#
# Installation: npm completion >> ~/.bashrc (or ~/.zshrc)
# Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm
#
if type complete &>/dev/null; then
_npm_completion () {
@seriousManual
seriousManual / movedata.json
Last active February 4, 2020 13:55
movedatathings
[
{
"dataSource": "derived:com.google.calories.expended:com.google.android.gms:from_activities",
"entries": [
{
"start": "2020-02-04T08:00:00+01:00",
"end": "2020-02-04T08:10:00+01:00",
"value": 12.833333333333332
},
{
import React from 'react'
import ReactDOM from 'react-dom';
import LaunchpadRenderer from './renderer'
import { Mock } from 'lunchpad'
import Shim from './shim/App';
import Wild from './examples/Wild' // random colors
import GoL from './examples/gol/Gol' // game of life: set the initial population via buttons, start with the red button
@seriousManual
seriousManual / workload_generator.ts
Created December 2, 2019 09:08
workload generator
import * as moment from 'moment';
import * as ms from 'ms';
function alignToInterval(time: moment.Moment, interval: string): moment.Moment {
const intervalMS = ms(interval);
const slot = Math.floor((time.unix() * 1000) / intervalMS) * intervalMS;
return moment.utc(slot);
}
const hirestime = require('hirestime');
const Redis = require('ioredis');
const stats = require('stats-lite');
const client = new Redis('redis://redis:6379');
const MAX_CARDINALITY = 1e6;
const times = [];
const timesGet = [];
@seriousManual
seriousManual / sync.html
Created July 25, 2019 09:45
Request synchronization
<html>
<head>
<script>
class Service {
inProgress = null;
async uploadData() {
if (!this.inProgress) {
console.log('ohay, I\'m actually doing a request');
function getGOL(size) {
return function(matrix) {
const result = [];
for (let x = 0; x < matrix.length; x++) {
result[x] = [];
for (let y = 0; y < matrix.length; y++) {
const count = countNeighbours(matrix, x, y);