Skip to content

Instantly share code, notes, and snippets.

View codehz's full-sized avatar
🔮

Neko Hz codehz

🔮
View GitHub Profile
@codehz
codehz / arrAction.js
Created July 12, 2016 16:21
Action delete, moveUp and moveDown
playListAction({action, index}) {
switch (action) {
case 'delete':
this.playList.splice(index, 1);
break;
case 'moveUp':
this.playList.splice((index - 1 + this.playList.length) % this.playList.length, 0, this.playList.splice(index, 0));
break;
case 'moveDown':
this.playList.splice((index + 1) % this.playList.length, 0, this.playList.splice(index, 0));
#include <iostream>
template<typename Target, typename Source>
struct force_cast {
union {
Source source;
Target target;
};
force_cast(Source source) : source(source) {};
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform vec2 resolution;
uniform vec2 offset;
uniform sampler2D backbuffer;
uniform vec3 gravity;
public class HelloWorld
{
public HelloWorld() {}
public static void main(String[] paramArrayOfString)
{
System.out.println(concat("233", 100));
}
public static String concat(String paramString, int paramInt) {
@codehz
codehz / simple_and_naivie_js_parser_combinator.js
Last active May 29, 2017 09:53
Simple ans naivie parser combinator for javascript
class Stream {
constructor(tokens) {
this.tokens = tokens
this.pos = 0
}
get next() {
return this.tokens[this.pos++] || ''
}
@codehz
codehz / Zhihu_MathJax.js
Last active November 13, 2022 10:51
知乎公式渲染强制使用MathJax
This file has been truncated, but you can view the full file.
// ==UserScript==
// @name Zhihu MathJax
// @namespace http://tampermonkey.net/
// @version 0.3
// @description 知乎公式渲染强制使用MathJax,配合AdBlock拦截www.zhihu.com/equation较为合适(因为用脚本隐藏还是会进行网络请求。。。)(修改自 https://zhuanlan.zhihu.com/p/27551432 ,感谢 @梨梨喵 和 @帅气可爱魔理沙 ,假装可以艾特到)
// @author CodeHz
// @match http*://*.zhihu.com/*
// @grant GM_addStyle
// ==/UserScript==
// MathJax single file build. Licenses of its components apply
@codehz
codehz / test.md
Last active December 10, 2017 02:40

test *test*

test **test**

test _test_

test __test__

@codehz
codehz / main.go
Created December 24, 2017 14:38
Steam-Discount-Sticker
package main
import (
"bytes"
"fmt"
"github.com/chai2010/webp"
"github.com/fogleman/gg"
"github.com/satori/go.uuid"
"golang.org/x/image/font"
"golang.org/x/image/tiff"
@codehz
codehz / style.less
Created April 1, 2018 09:12
Atom-blur
html,
atom-workspace,
atom-workspace-axis,
status-bar,
atom-panel-container,
atom-pane-container,
atom-pane-axis,
atom-pane > *,
atom-dock,
atom-dock > *,
@codehz
codehz / make_callback_x86_64_linux_gnu.cpp
Last active September 17, 2018 03:08
Function object to function pointer
#include <functional>
#include <sys/mman.h>
#include <boost/callable_traits/function_type.hpp>
template <typename T> struct FunctionWrapper;
template <typename R, typename... PS> struct FunctionWrapper<R(PS...)> {
short mov_r10 = 0xba49;
std::function<R(PS...)> *func;
short mov_rax = 0xb848;