Skip to content

Instantly share code, notes, and snippets.

View arthurmchr's full-sized avatar

Arthur arthurmchr

View GitHub Profile
import smartpy as sp
class SpectrumColors(sp.Contract):
def __init__(self):
self.init(
# fixed dimensions of the board
columns = 16,
rows = 16,
# limit to the total number of colors possible
max_colors = 12,
@robomatic
robomatic / fetchImages.js
Created October 25, 2021 23:15
fetch remote images for next ssg
// Dependencies :
// npm i download jsdom walk replaceall
const path = require('path')
const fsp = require('fs/promises')
const download = require('download')
const walk = require('walk')
const replaceAll = require("replaceall");
const { JSDOM } = require('jsdom')
// Dependencies :
// npm i download jsdom walk replaceall
const path = require('path')
const fsp = require('fs').promises
const download = require('download')
const walk = require('walk')
const replaceAll = require("replaceall");
const { JSDOM } = require('jsdom')
@ulises-codes
ulises-codes / SanityImageLoader.ts
Last active February 21, 2024 16:44
Custom Sanity loader for Next JS Image component.
import Image, { ImageProps } from 'next/image';
import { imageBuilder } from './sanity';
import type { SanityImageSource } from '@sanity/image-url/lib/types/types';
interface MyImageProps extends Omit<ImageProps, 'src'> {
src: SanityImageSource;
quality?: number;
blur?: number;
}
@patrickmatte
patrickmatte / gist:ed2ae277172c0c5d084a9e3e733bb415
Last active May 8, 2024 10:20
CSS easing methods based on Robert Penner's, as accurate as possible to do with cubic-bezier
$easeLinear: cubic-bezier(0, 0, 1, 1);
$easeSineInOut: cubic-bezier(0.37, 0, 0.63, 1);
$easeSineIn: cubic-bezier(0.12, 0, 0.39, 0);
$easeSineOut: cubic-bezier(0.61, 1, 0.88, 1);
$easeQuadraticInOut: cubic-bezier(0.45, 0, 0.55, 1);
$easeQuadraticIn: cubic-bezier(0.11, 0, 0.5, 0);
$easeQuadraticOut: cubic-bezier(0.5, 1, 0.89, 1);
$easeCubicInOut: cubic-bezier(0.65, 0, 0.35, 1);
$easeCubicIn: cubic-bezier(0.32, 0, 0.67, 0);
$easeCubicOut: cubic-bezier(0.33, 1, 0.68, 1);
@kunofellasleep
kunofellasleep / gaussianBlur.js
Created May 21, 2019 05:54
Gaussian Blur on Spark AR
// Created by @kunofellasleep on 2019/05/20.
//Modules
const Diagnostics = require('Diagnostics');
const Materials = require('Materials');
const Textures = require('Textures');
const CameraInfo = require('CameraInfo');
const Shaders = require('Shaders');
const R = require('Reactive');
@crrapi
crrapi / webserver_and_bot.py
Last active December 7, 2023 16:47
(Don't use if you can) Run a Flask app and a discord.py bot in one program using threads.
# Note: You really should not use this.
# You can easily convert your app
# to use Quart by using async+await
# and then use loop.create_task(bot.start(...))
# before using app.run.
from threading import Thread
from flask import Flask
from functools import partial
from discord.ext import commands
@mattdesl
mattdesl / motion-blur.js
Last active January 2, 2022 12:05
canvas-sketch + motion blur + canvas2D (NOTE: Only blurs on sequence export) adapted from @delucis
// Adapted from @delucis
// https://github.com/delucis/pellicola/blob/735bd7487bdc597ac7272e4ddce9473c15f68d09/lib/frame-maker.js#L99-L134
const canvasSketch = require('canvas-sketch');
const settings = {
dimensions: [ 512, 512 ],
duration: 3,
animate: true,
fps: 24
@astojilj
astojilj / index.html
Created October 29, 2018 12:33
TensorFlow.js CNN Background Removal
<html>
<head>
<body onload="onLoad()">
<div id="container">
<div id="show-background">Show background as magenta<input id="show-background-toggle" type="checkbox" checked></div>
<canvas id="canvas" width=640px height=480px></canvas>
</div>
</body>
</head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"> </script>
@gachiemchiep
gachiemchiep / main.py
Created August 16, 2018 02:26
Write/Read image data on Redis using opencv or PIL
import redis
import cv2
import numpy as np
import time
import io
from PIL import Image
r = redis.StrictRedis.from_url('redis://:[email protected]:6379/1')
img_path ="image"