Skip to content

Instantly share code, notes, and snippets.

View blackmann's full-sized avatar
💭
🤟

Degreat blackmann

💭
🤟
View GitHub Profile

Timeline editor

Preview

As seen in apps like Adobe After Effects, Rive (rive.app), Blender, Final Cut, motion-canvas etc. a timeline editor is used to assist in editing visual (or even audible) media elements.

In this challenge, you will design a timeline editor with the following features:

  1. Layers: the editor panel should consist of three main layers. From top to bottom:
@blackmann
blackmann / gen-ssl.sh
Created September 17, 2022 10:31
Generate SSL key and cert for localhost
#!/usr/bin/env
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
import Chart from 'chart.js'
import { useEffect, useRef } from 'react'
/**
* @param {object} props
* @param {{label: string, value: string}[]} props.data
*/
function DataChart({ data, id, graphColor = '#68AC67', label, type = 'bar' }) {
const oldChart = useRef()
@blackmann
blackmann / asteroid-0.js
Created January 6, 2022 10:39
Asteroid game with matter js
import {
Bodies,
Body,
Common,
Composite,
Engine,
Events,
Mouse,
Render,
Runner,
@blackmann
blackmann / analog-screen.js
Created November 3, 2021 09:34
Analog screen
export const fontDefinition = {
A: [
[0, 1, 1, 0],
[1, 0, 0, 1],
[1, 1, 1, 1],
[1, 0, 0, 1],
[1, 0, 0, 1],
],
B: [],
C: [],
@blackmann
blackmann / use-batched-hook.js
Created July 30, 2021 13:27
Batching hooks for result
import { useEffect, useState } from 'react'
export function useFirst() {
const [value, setValue] = useState(0)
useEffect(() => {
setTimeout(() => {
setValue(1)
}, 4000)
}, [])
const ShopSchema = new Schema({ /** definitions */})
ShopSchema.pre('deleteOne', async function (shop) {
// Note, don't use arrow function, unless you realize the shop is passed
// to the middleware instance. Read below:
// right now the document is unclear whether it passes the instance
// of the object to the middleware or the `this` is the instance
// so to test, do this
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:habanero/models/models.dart';
class CartItem {
final MenuItem item;
int count = 0;
double get total => item.price * count;
@blackmann
blackmann / uploader.js
Last active November 24, 2020 12:19
Cloudinary upload utility
import axios from 'axios'
const CLOUNDINARY_URL = 'https://api.cloudinary.com/v1_1/<CLOUD_NAME>/image/upload/'
const UPLOAD_PRESET = 'XXXXXXX'
export default async (file) => {
const formData = new FormData()
formData.append('file', file)
formData.append('upload_preset', UPLOAD_PRESET)
@blackmann
blackmann / get_revenue.py
Created November 12, 2020 21:55
Hahahahaha
data.append({
'title': 'Revenue',
'value': models.Order.objects.filter(valid=True).annotate(total=ExpressionWrapper((F('vehicle_rate__rate') + F('driver_rate__rate')) * F('days'), DecimalField())).values('total').aggregate(Sum('total'))['total__sum'],
'prefix': 'GHS'
})