This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.utils = (function() { | |
function touch(el, type, listener) { | |
if (type === 'tap') { | |
var isDragging, startPos; | |
function touchStart(e) { | |
el.addEventListener('touchmove', touchMove); | |
el.addEventListener('touchend', touchEnd); | |
isDragging = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
template<typename T> | |
T make_symbol(T value, string metadata); | |
template<typename T> | |
string get_symbol_for(T value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
node: true | |
es6: true | |
parserOptions: | |
ecmaVersion: 2020 | |
sourceType: module | |
extends: | |
- airbnb-base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { onMount } from 'svelte'; | |
function noop() { } | |
function run(fn) { | |
return fn(); | |
} | |
function blank_object() { | |
return Object.create(null); | |
} | |
function run_all(fns) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { makeOperation } from '@urql/svelte' | |
import { authExchange } from '@urql/exchange-auth' | |
import { Auth } from 'aws-amplify' | |
import produce from 'immer' | |
import { set } from 'lodash' | |
const amplifyAuthExchange = authExchange({ | |
addAuthToOperation: ({ authState, operation }) => { | |
if (!authState?.token) { | |
return operation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROXY_URL=<your_proxy_url> | |
echo "HTTP" | |
time ( | |
curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Transform } = require('stream') | |
const { createGzip } = require('zlib') | |
const fs = require('fs') | |
const testfile = fs.createWriteStream('test.gz') | |
const createShoutyStream = () => new Transform({ | |
construct(cb) { | |
this.data = '' | |
cb() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https') | |
const { PassThrough } = require('stream') | |
class WarcAgent extends https.Agent { | |
createConnection(...args) { | |
const socket = super.createConnection(...args) | |
const request = new PassThrough() | |
const response = new PassThrough() | |
// request stream via monkey-patching | |
const origWrite = socket.write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { flip } from 'svelte/animate' | |
import { dndzone, TRIGGERS } from 'svelte-dnd-action' | |
import { zip } from 'lodash' | |
export let ids | |
export let getItem | |
// distribute items over column count | |
let colCount = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Redis from 'ioredis' | |
const { | |
HOST: host, | |
PORT: port, | |
} = process.env | |
const redis = new Redis({ host, port }) | |
const subscribe = async (key, notifKey) => { |
OlderNewer