Skip to content

Instantly share code, notes, and snippets.

View turtleDev's full-sized avatar
💭
🐢

Saravjeet 'Aman' Singh turtleDev

💭
🐢
View GitHub Profile
@shivamMg
shivamMg / curry.go
Created January 5, 2019 13:30
Currying
package main
type VarSum func(a ...int) interface{}
func curry(fn func(x, y, z int) int, args ...int) interface{} {
if len(args) >= 3 {
return fn(args[0], args[1], args[2])
}
return VarSum(func(more ...int) interface{} {
args = append(args, more...)
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active April 7, 2025 13:55
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@guilhermesimoes
guilhermesimoes / README.md
Last active September 10, 2023 13:12
YouTube's new morphing play/pause SVG icon

As soon as I saw the new YouTube Player and its new morphing play/pause button, I wanted to understand how it was made and replicate it myself.

From my analysis it looks like YouTube is using [SMIL animations][1]. I could not get those animations to work on browsers other than Chrome and it appears [that they are deprecated and will be removed][2]. I settled for the following technique:

  1. Define the icon path elements inside a defs element so that they are not drawn.

  2. Draw one icon by defining a use element whose xlink:href attribute points to one of the paths defined in the previous step. Simply [changing this attribute to point to the other icon is enough to swap them out][3], but this switch is not animated. To do that,

  3. Replace the use with the actual path when the page is loaded.

@staltz
staltz / introrx.md
Last active April 19, 2025 05:15
The introduction to Reactive Programming you've been missing
@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions