Skip to content

Instantly share code, notes, and snippets.

View yshwaker's full-sized avatar
🚀

Shihao Yu yshwaker

🚀
View GitHub Profile
@yshwaker
yshwaker / text-gradient-color.css
Last active October 10, 2022 08:23
Text with gradient color
h1 {
background: linear-gradient(30deg, #c850c0, #ffcc70);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
@yshwaker
yshwaker / promise.js
Last active November 20, 2022 07:04
Promise Implementation
function addToTaskQueue(fn) {
// 模拟浏览器微任务
setTimeout(fn, 0)
}
function isThenable(value) {
return typeof value?.then === 'function';
}
class MyPromise {
@yshwaker
yshwaker / add_vertex_group_mirror.py
Last active November 11, 2021 05:42
create mirror of active vertex group as a new vertex group
import bpy
bpy.ops.object.vertex_group_copy()
bpy.ops.object.vertex_group_mirror(flip_group_names=False,use_topology=True)
# only select one object at a time
selected_obj = bpy.context.selected_objects[0]
active_vertex_group = selected_obj.vertex_groups.active
public static double sqrt(double c) {
if (c < 0) return Double.NaN;
double err = 1e-15;
double t = c;
while (Math.abs(t-c/t) >= err * t)
{
t = (t + c/t) / 2.0;
}
return t;
}