Skip to content

Instantly share code, notes, and snippets.

View AviKav's full-sized avatar

AviKav

  • United States
  • 04:24 (UTC -04:00)
  • X @Avi_Kav
View GitHub Profile
@AviKav
AviKav / recursiveAssign.js
Last active February 8, 2017 04:40
Recursive version of `Object.assign()`
function recursiveAssign(target, ...sources) {
for (let i of let objs = Object.keys(sources)) {
let obj = sources[objs[i]];
if ((typeof obj !== "object" || obj === null) && obj === sources[sources.length-1]) {
// If `sources[objs[i]]` is a a non `Object` built-in and the is (or is the same as) last element in `sources`, then there is no need to go any further. Also, `typeof null === "object"`
if (obj === sources[sources.length-1]) {
target = obj;
return;
}
} else {
let downloaded = new Set();
let observer = new MutationObserver(arr => {
for (let mutationRecord of arr) {
for (let node of Array.from(mutationRecord.addedNodes)) {
let canvas = node.parentElement.getElementsByTagName("canvas")[0];
if (canvas && !downloaded.has(canvas.id)) {
downloaded.add(canvas.id);
saveCanvasAsPNG(canvas);
}
}
[b]Moderator's Note:[/b]
Do not report this series for not being of Asian origin, this comic is an exception due to being heavily inspired by Japanese culture and manga art styles.
#To compile with optimisations, pass RELEASE=1 when calling make
ALLEGRO_MODULES = allegro-5 allegro_audio-5 allegro_acodec-5 allegro_dialog-5 allegro_font-5 allegro_image-5 allegro_primitives-5
CFLAGS = $$(pkg-config --cflags $(ALLEGRO_MODULES)) -Wall
LIBS = -lm $$(pkg-config --libs $(ALLEGRO_MODULES))
HEADERS = $(shell find src/ -name '*.h')
OBJECTS = $(shell find src/ -name '*.c' | sed -e 's/\.c$$/.o/g')
.PHONY: all clean
RELEASE ?= 1
ifeq ($(RELEASE), 1)
@AviKav
AviKav / index.html
Last active March 30, 2019 02:11 — forked from TimothyGu/index.html
for-of loop vs forEach (https://jsbench.github.io/#3e02cc5ae174106bb0de5e00435a3b7e) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>for-of loop vs forEach</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
#!/usr/bin/env python
import scipy.stats
percentile_range = 50 # Centered in the middle of the distribution
math_lower = 650
math_upper = 740
reading_writing_lower = 650
reading_writing_upper = 710
@AviKav
AviKav / keybase.md
Last active January 12, 2020 10:25

Keybase proof

I hereby claim:

  • I am AviKav on github.
  • I am avikav (https://keybase.io/avikav) on keybase.
  • I have a public key whose fingerprint is 291C C1F9 2AD7 1238 A05F 86A0 7BC4 B96B C8A7 167D

To claim this, I am signing this object:

@AviKav
AviKav / vim_crash_course.md
Created November 30, 2020 23:23 — forked from dmsul/vim_crash_course.md
Vim Crash Course

NOTE: Specific examples given for options, flags, commands variations, etc., are not comprehensive.

NORMAL MODE

Vim has 2 main "modes", that chance the behavior of all your keys. The default mode of Vim is Normal Mode and is mostly used for moving the cursor and navigating the current file.

Some important (or longer) commands begin with ":" and you will see the text you enter next at the bottom left of the screen.

:q[uit] - quit (the current window of) Vim. ("Window" here is internal to Vim, not if you have multiple OS-level windows of Vim open at once.)
:q! - force quit (if the current buffer has been changed since the last save)
:e[dit] {filename} - read file {filename} into a new buffer.

I am the Miaou user with id 6248 and name "AviKav" on https://miaou.dystroy.org