View main.rs
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
#![cfg_attr( | |
all(not(debug_assertions), target_os = "windows"), | |
windows_subsystem = "windows" | |
)] | |
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command | |
#[tauri::command] | |
fn sync(name: &str) -> String { | |
format!("Hello, {}! You've been greeted from Rust!", name) |
View worker.js
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
// Based on https://gist.github.com/vdbelt/20f116236d2ebffa92f131e679c0551a | |
addEventListener('fetch', event => { | |
event.respondWith(purgeCache(event.request)) | |
}) | |
async function purgeCache(request) { | |
// get zone querystring value | |
const zone = new URL(request.url).searchParams.get('zone'); |
View scramble.ts
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
export default ( | |
options: { imageData: ImageData; amount: number }, | |
done: (err: string, imageData: ImageData) => void | |
): void => { | |
const { imageData, amount = 1 } = options; | |
const intensity = Math.round(Math.max(1, amount) * 2); | |
const range = Math.round(intensity * 0.5); | |
const inputWidth = imageData.width; |
View convolution.ts
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
export default ( | |
options: { imageData: ImageData; matrix: number[] }, | |
done: (err: string, imageData: ImageData) => void | |
): void => { | |
const { imageData, matrix } = options; | |
if (!matrix) return done(null, imageData); | |
// calculate kernel weight | |
let kernelWeight = matrix.reduce((prev, curr) => prev + curr); |
View simulate-pointers.js
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 DEBUG = false; | |
const style = document.createElement('style'); | |
style.textContent = ` | |
.sim-pointer { | |
margin-top: -1px; | |
position: absolute; | |
z-index: 9999999999999; | |
left: -24px; |
View code-macro.njk
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
{% macro codeline(x, y, totalStatements, spaceWidth) %} | |
{% set offset = x %} | |
{% for i in range(0, totalStatements) -%} | |
{% set width = [2, 4, 8, 12, 24] | random %} | |
{% set opacity = [0.5, 0.75, 1] | random %} | |
<path d="M{{ offset }} {{ y }} h{{width}}" opacity="{{ opacity }}"/> | |
{% set offset = offset + width + spaceWidth %} | |
{% endfor %} |
View nudgeable.ts
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
export default (element: HTMLElement, options: any = {}) => { | |
// if added as action on non focusable element you should add tabindex=0 attribute | |
const { | |
direction = undefined, | |
shiftMultiplier = 10, | |
bubbles = false, | |
stopKeydownPropagation = true, | |
} = options; |
View cloudinary.js
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 createCloudinary = (cloudName, unsignedUploadPreset) => ({ | |
process: (fieldName, file, metadata, load, error, progress, abort) => { | |
// `fieldName` and `meta` are not used for now | |
const url = `https://api.cloudinary.com/v1_1/${cloudName}/upload`; | |
const xhr = new XMLHttpRequest(); | |
const formData = new FormData(); |
View gist:a906d3da0ded79738364b26a5c8167f6
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
zwarte pieten, zwarte piet, democracy, @realDonaldTrump, referendum, Vote Leave, women in tech, lgbt+, lgbt, she-ra, #remain, NHS, russians, russian, politics, milo, kardashian, sarah sanders, capitalist, Socialist, socialism, capitalism, linkedin, politician, Russia, Musk's, Mansplainers, Mansplains, Mansplain, Mansplainer, government, musk, Cambridge Analytica, handmaids, soccer, football, mansplaining, west world, dolores, westworld, conservatives, Nigel Farage, men, harassment, health care, Tory, flat earth, feminist, feminism, religious, religion, republican, republicans, white house, comey, climate change, trans, pizzagate, ar-15, Putin, NRA, trans people, Cis people, vagina, blackmirror, Black Mirror, healthcare, tories, tax bill, white supremacy, male colleague, white men, PoC, white walker, #GameOfThrones, game of thrones, ukip, nazism, fascism, fascis, fascist, racial, Nazis, Trump's, bitcoin, Brexiters, diversity, brexit, confederate, antifa, nazi, sexism, supremist, racist, racism, sexist, Trump |
View addGradientSteps.js
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 easeInOutSine = t => -0.5 * (Math.cos(Math.PI * t) - 1); | |
export const addGradientSteps = ( | |
// the gradient to add the steps to | |
gradient, | |
// the color of the gradient (in rgb) and target alpha value | |
color = [0, 0, 0], alpha = 1, | |
// the ease function to use and the amount of steps to render (higher is more precision) |
NewerOlder