Skip to content

Instantly share code, notes, and snippets.

export class Fish {
constructor() {
this.pos = createVector(R.random_num(0, W), R.random_num(0, H)); // Position vector of fish
this.poi = createVector(0, 0); // Position vector of interest
this.vel = createVector(R.random_dec() * M, R.random_dec() * M); // initialize velocity in unit vector
this.facing = this.vel.heading() // facing of fish
this.speed = R.random_num(0.3, 1) * M; // magnitude to scale vel
this.maxTurn = PI / R.random_int(512, 1024);
this.fl = round(R.random_int(175, 225) * M);
this.laziness = R.random_int(1, 1000);
@comficker
comficker / vim-command-line.md
Last active December 21, 2023 03:58
Vim Command Line
Shortcut Description
<C-r><C-w> Insert current word into the command line
<C-r>\" Paste from " register
<C-x><C-f> Auto-completion of path in insert mode

Vim Cheat Sheet

@comficker
comficker / docker-compose-static-web.yaml
Last active December 15, 2023 07:31
docker compose for static web yaml
version: '3.7'
services:
web:
image: nginx:alpine
ports:
- "8000:80"
volumes:
- ./app:/usr/share/nginx/html
@comficker
comficker / docker-compose.yaml
Last active December 15, 2023 07:18
Example Docker Compose .yaml file
version: "3"
services:
redis:
image: redis:alpine
ports:
- "6379"
networks:
- frontend
deploy:
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="">
<meta property="og:type" content="">
window.addEventListener('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
});
window.addEventListener('drop', function(e) {
e.stopPropagation();
e.preventDefault();
if(e.dataTransfer.files.length === 0) {
return alert("Seems like you tried to drag-and-drop an image from another browser window? You need to download the image to your computer (right-click, then save image) and then drag-and-drop the downloaded image. Sorry!");
// Requiring lodash library
const _ = require('lodash');
// Using _.debounce() method
// with its parameters
var debounce_fun = _.debounce(function () {
console.log('Function debounced after 1000ms!');
}, 1000);
debounce_fun();
@comficker
comficker / Install mochaJS.md
Created October 11, 2022 04:23
Mocha Installation
$ npm install mocha
$ mkdir test
$ $EDITOR test/test.js # or open with your favorite editor

Mocha Cheat Sheet

The position property specifies the type of positioning method used for an element (static, relative, fixed, absolute or sticky).
- Position: `position: static | relative | absolute | fixed | sticky`
- Position Properties: `top | right | bottom | left `
- Float Element: `float: left | right | none`
- Clear Floating Elements: `clear: none | left | right | both`
- Index: `z-index: 3 | auto | inherit`
[CSS Cheat Sheet](https://simplecheatsheet.com/tag/css-cheat-sheet/)
@comficker
comficker / chain_list.json
Last active June 10, 2022 09:28
Chain List
[
{
"name": "Ethereum Mainnet",
"rpc": [
"https://cloudflare-eth.com"
],
"shortName": "ethereum-mainnet"
},
{
"name": "Binance Smart Chain Mainnet",