Skip to content

Instantly share code, notes, and snippets.

View huruji's full-sized avatar
☂️
被社会毒打的频率奇高

huruji huruji

☂️
被社会毒打的频率奇高
View GitHub Profile
@huruji
huruji / hello-world.cc
Created October 6, 2021 17:01 — forked from tejom/hello-world.cc
console.log v8
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <iostream>
@huruji
huruji / binding.gyp
Created October 6, 2021 18:01 — forked from bellbind/binding.gyp
[nodejs]Native module with libuv and v8::Promise on node-4
# -*- mode: python -*-
{
"targets": [
{
"include_dirs": ["<!(node -e \"require('nan')\")"],
"target_name": "TimerAndPromise",
"sources": [
"timer-and-promise.cc"
],
"conditions": [
@huruji
huruji / ex1
Created October 6, 2021 19:13 — forked from Quby/ex1
libuv example, timers and mkdir
#include "./../deps/libuv/include/uv.h"
#include <stdio.h>
int msg;
void mkdir_cb (uv_fs_t* req) {
int* msg = req->data;
printf("send(%d)\n", *msg);
}
@huruji
huruji / gist:2d26f4d18436e43fbd8092fe5b0e2a49
Last active December 20, 2021 06:34 — forked from hyg/gist:9c4afcd91fe24316cbf0
在golang中打开浏览器
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@huruji
huruji / README.md
Created September 22, 2024 09:20 — forked from veltman/README.md
Gif rendering - SVG to GIF

Testing in-browser gif generation from an SVG with gif.js. Works in recent Chrome/Safari/Firefox.

Process:

  1. Create a standard SVG line chart.
  2. Step through in-between frames of the line chart: for each one, update the SVG, render to an image, add the image element to a stack of gif frames.
  3. Render frames together in the background using gif.js web workers.
  4. When rendering's complete, add the blob URL as an image and start the SVG on an infinite loop with d3.timer (gratuitous).

See also: Gif Globe, Gif New Jersey