Skip to content

Instantly share code, notes, and snippets.

View defims's full-sized avatar

Long, Wei defims

View GitHub Profile
@ngxson
ngxson / FAQ.md
Last active February 27, 2025 00:51
convert ARM NEON to WASM SIMD prompt

Why did you do this?

Relax, I only have one Sunday to work on idea, literally my weekend project. So I tried Deepseek to see if it can help. Surprisingly, it works and it saves me another weekend...

What is your setup?

Just chat.deepseek.com (cost = free) with prompts adapted from this gist.

Does it work in one-shot or I have to prompt it multiple times?

introduction

inspired by a friend’s fledgling language design and motivated by the JeanHeyd Meneide RustConf Fiasco™ and improving the story for compile-time introspection, i decided i needed a place to spew the last year’s musings on variadic generics in Rust in one mighty, less-than-understandable catharsis.

i think somewhere in here is a considered and reasonable design, so that’s neat!

perhaps i’ll make this an RFC one day. probably not. you have my express permission to do that yourself.

variadic generics?

this nugget of language jargon encapsulates the idea that we might want to bind to an arbitrarily large list of generic parameters, all at once. there are many reasons to want to do this:

@PCreations
PCreations / rxjs-diagrams.md
Last active September 26, 2024 01:44
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K
@uchcode
uchcode / jxa-snippets.js
Last active March 6, 2025 22:14
JXA (JavaScript for Automation) snippets for applet.
function MenuItem(title, action, target) {
if (!title && !action && !target) return $.NSMenuItem.separatorItem
let i = $.NSMenuItem.alloc.init
i.title = title
i.action = action
i.target = target
return i
}
function StatusItem() {
@defims
defims / selected-frames-svg-smil-path-data-generator.jsfl
Last active June 21, 2016 02:53
selected frames svg smil path data generator by Def ([email protected])
/*
MIT license
what:
selected frames svg smil path data generator by Def ([email protected])
why:
[Flash2Svg](https://github.com/TomByrne/Flash2Svg) and [SnapSVG-Animator](http://cjgammon.github.io/SnapSVG-Animator/) are awesome.
but both of them generate shape tween svg code in frame by frame way.
this script generate svg path code in the keyframe way flash used.
@lmrrcc
lmrrcc / app.swift
Last active January 24, 2025 16:31
swift osx application without nib
import Cocoa
class WindowController: NSWindowController {
}
class AppDelegate: NSObject {
var mainWindow: NSWindow?
var mainController: NSWindowController?
}
@divarvel
divarvel / continuation.js
Last active May 27, 2023 08:12
implementation of the continuation monad in JS
console.log("\033[39mRunning tests…");
function assertEquals(actual, expected, description) {
if(typeof actual === "undefined") {
console.error("\033[31m" + description + " not implemented\033[39m");
} else {
if(actual !== expected) {
console.error("\033[31m" + description + " failed, expected " + expected + ", got " + actual + "\033[39m");
} else {
console.log(description + " \033[32m ok\033[39m");
}
// Polyfill for ES6 Object.observe()
// Limitations:
// - No 'splice' (etc); if you're observing an Array, you're gonna have a bad time
(function(global) {
function assert(e) { if (!e) throw new Error('Assertion failed'); }
// http://wiki.ecmascript.org/doku.php?id=harmony:observe
// ECMAScript internal approximations
@shiweifu
shiweifu / lweb.lua
Created June 22, 2012 06:21
lua static webserver
socket = require("socket")
httpcode = require("httpcode")
require("mime")
getMime = mime.getMime
assert(getMime)
function main( p )
local port
@gre
gre / easing.js
Last active February 26, 2025 11:46
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {