Skip to content

Instantly share code, notes, and snippets.

.part.titlebar {
display: none !important;
}
.monaco-workbench {
background-color: rgba(0, 0, 0, 0);
}
@ragingwind
ragingwind / shorten.py
Last active July 7, 2018 01:48
Shorten URL with markdown for Alfred. Added title to origin https://github.com/hzlzh/Alfred-Workflows
'''
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
@ragingwind
ragingwind / nginx.conf
Created August 5, 2019 09:19
Redirect old-classic browser including IE 11
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_user_agent $outdated {
default 0;
"~MSIE [1-10]\." 1;
@ragingwind
ragingwind / flipclock.html
Created August 25, 2019 20:29
Classic Flipclock
<!--
* 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>
{
"recordMap": {
"block": {
"bc607894-081d-4905-9abf-fae6f9533a44": {
"role": "reader",
"value": {
"id": "bc607894-081d-4905-9abf-fae6f9533a44",
"version": 138,
"type": "page",
"properties": {
@ragingwind
ragingwind / index.js
Created July 28, 2020 08:02
Simple Bridge App for ProtoPie Connect
const io = require('socket.io-client');
function main(address, message) {
const socket = io(address);
socket.on('connect', () => {
socket.emit('ppMessage', { messageId: message });
socket.disconnect();
});
}
@ragingwind
ragingwind / TypedArrayToHeap.js
Last active August 17, 2020 08:29
Allocate memory with typed array
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 / callstack.ts
Created October 21, 2020 00:21
Callstack for javascript
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 / rgb.cpp
Created May 13, 2021 23:31
RGB Class for Modern C++
#include <iostream>
#include <string>
#include <map>
#include <cxxabi.h>
class RGB {
public:
using value_type = std::tuple<unsigned, unsigned, unsigned>;
RGB(unsigned r, unsigned g, unsigned b) : m_r(r), m_g(g), m_b(b) {}
@ragingwind
ragingwind / .swcrc
Created November 2, 2021 02:23
swcrc
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false,
"dynamicImport": false,
"privateMethod": false,
"functionBind": false,
"classPrivateProperty": false,
"exportDefaultFrom": false,