Skip to content

Instantly share code, notes, and snippets.

Avatar
👷‍♂️
Working from home

JIMMY ムン (MOON) ragingwind

👷‍♂️
Working from home
View GitHub Profile
@ragingwind
ragingwind / callstack.ts
Created Oct 21, 2020
Callstack for javascript
View callstack.ts
import { sep } from 'path';
function splitPath(filename, level: number) {
const paths = filename.split(sep);
return paths.splice(paths.length - level).join(sep);
}
export function caller(level: number) {
const oldStackTrace = Error.prepareStackTrace;
try {
@ragingwind
ragingwind / TypedArrayToHeap.js
Last active Aug 17, 2020
Allocate memory with typed array
View TypedArrayToHeap.js
function TypedArrayToHeap(arr) {
const { name, BYTES_PER_ELEMENT } = arr.constructor;
const prefix = name.charAt(0).replace(/I|B/, '');
const heap = Module[`HEAP${prefix}${BYTES_PER_ELEMENT << 3}`];
if (!heap) {
throw new Error(`Unknow typed array ${heap}`);
}
const ptr = Module._malloc(arr.length * BYTES_PER_ELEMENT);
heap.set(arr, ptr / BYTES_PER_ELEMENT);
@ragingwind
ragingwind / index.js
Created Jul 28, 2020
Simple Bridge App for ProtoPie Connect
View index.js
const io = require('socket.io-client');
function main(address, message) {
const socket = io(address);
socket.on('connect', () => {
socket.emit('ppMessage', { messageId: message });
socket.disconnect();
});
}
View notion-page-v3.json
{
"recordMap": {
"block": {
"bc607894-081d-4905-9abf-fae6f9533a44": {
"role": "reader",
"value": {
"id": "bc607894-081d-4905-9abf-fae6f9533a44",
"version": 138,
"type": "page",
"properties": {
View flipclock.html
<!--
* Copyright (c) 2010 devnight.net. All rights reserved. Use of this
* source code is governed by a MIT license that can be found in the
* LICENSE file.
-->
<!DOCTYPE html>
<html>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<head>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
@ragingwind
ragingwind / nginx.conf
Created Aug 5, 2019
Redirect old-classic browser including IE 11
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_user_agent $outdated {
default 0;
"~MSIE [1-10]\." 1;
@ragingwind
ragingwind / shorten.py
Last active Jul 7, 2018
Shorten URL with markdown for Alfred. Added title to origin https://github.com/hzlzh/Alfred-Workflows
View shorten.py
'''
Shorten URL v1.5
Github: https://github.com/hzlzh/Alfred-Workflows
Author: hzlzh (hzlzh.dev@gmail.com)
Twitter: @hzlzh
Blog: https://zlz.im/Alfred-Workflows/
'''
# encoding: utf-8
View vscode_custom.css
.part.titlebar {
display: none !important;
}
.monaco-workbench {
background-color: rgba(0, 0, 0, 0);
}
@ragingwind
ragingwind / won-as-backquote.sh
Last active Apr 14, 2018
Backquote binding for won key
View won-as-backquote.sh
mkdir -p ~/Library/KeyBindings &&
echo '{ "₩" = ("insertText:", "`"); }' >> ~/Library/KeyBindings/DefaultkeyBinding.dict
@ragingwind
ragingwind / launch.json
Created Apr 9, 2018
Debugging electron app with vscode
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron: Main",
"protocol": "inspector",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"runtimeArgs": [
You can’t perform that action at this time.