Skip to content

Instantly share code, notes, and snippets.

View miaopeng's full-sized avatar
🎯
🎧 🎨 🎦 🚶

Peng Miao (mios) miaopeng

🎯
🎧 🎨 🎦 🚶
  • 观云
  • Beijing, China
View GitHub Profile
@clannadxr
clannadxr / sxzy_login.js
Last active May 7, 2024 03:40
sxzy_login
// ==UserScript==
// @name sxzy
// @namespace https://clannadxr.com/
// @version 0.5
// @author clannadxr
// @match http://122.191.123.18:18080/DrcomManager/index.do
// @match http://122.191.123.18:18080/MAuth/home/toHome
// @match http://122.191.123.18:18080/DrcomSso/sso/index
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// ==UserScript==
// @name Photopea Premium
// @namespace http://tampermonkey.net/
// @version 2024-02-03
// @description Unlock Photopea Premium by patching their JS
// @author mat
// @match https://www.photopea.com/
// @match https://www.photopea.com/?utm_source=homescreen
// @icon https://www.google.com/s2/favicons?sz=64&domain=photopea.com
// @grant GM_webRequest
@Mechetel
Mechetel / .fasterer.yml
Last active October 14, 2024 14:07
production setup for any project
speedups:
rescue_vs_respond_to: true
module_eval: true
shuffle_first_vs_sample: true
for_loop_vs_each: true
each_with_index_vs_while: false
map_flatten_vs_flat_map: true
reverse_each_vs_reverse_each: true
select_first_vs_detect: true
sort_vs_sort_by: true
// /swr/project.js
import useSWR, { mutate } from 'swr'

export async function fetchProject (id) {
  mutate(`/api/project/${id}`, fetch(`/api/project/${id}`))
}

export default function useProject (id) {
 // don't pass the fetcher so it won't fetch
@christianklotz
christianklotz / sketch-load-json.js
Created March 19, 2019 15:59
Load JSON file into Sketch
let readBinaryFile = (filepath) => {
return NSData.alloc().initWithContentsOfFile(filepath);
};
let path = "path/to/file.json"
let data = readBinaryFile(path)
let contents = NSString.alloc().initWithData_encoding(data, NSUTF8StringEncoding)
console.log(JSON.parse(contents))
@zhangzhibin
zhangzhibin / ScreenShotNode.ts
Last active July 16, 2019 12:59
A screenshot component for Cocos Creator 2.0.5 written in typescript
// https://xmanyou.com/cocos-creator-jie-tu-gong-neng-dai-ma/
// 截图组件 (如果没有提前添加Camera组件,则会自动添加一个默认参数的Camera)
// 语言:Typescript
// Cocos Creator 版本: 2.0.5
// 使用方法:
// 1. 在场景里添加一个Node, 把这个组件拖进去
// 2. 在需要截图的地方,import, 然后调用:ScreenShotNode.take()
// Screenshot component
// typescript
@Tamal
Tamal / git-ssh-error-fix.sh
Last active October 31, 2025 02:02
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@wmzy
wmzy / nginx.conf
Last active October 17, 2024 04:20
spa nginx config | 单页应用 nginx 配置
upstream backend {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name your.hostname.com;
proxy_set_header Host $http_host;
access_log /tmp/test-access.log debug;
rewrite_log on;
@verticalgrain
verticalgrain / app.js
Last active April 26, 2022 15:37
React Router V4 Redirect after form submission
import React, { Component } from 'react'
import { Redirect } from 'react-router'
export default class ContactForm extends Component {
constructor () {
super();
this.state = {
fireRedirect: false
}
}
@armollica
armollica / README.md
Last active December 13, 2023 12:29
Convert SVG to Canvas

Convert SVG to canvas on-the-fly.

This article from MDN explains the process: Drawing DOM object into a canvas. This works for any DOM object, not just SVG. Not sure if this is well supported by older browsers. Works on Chrome, Firefox and IE 10 for me. The bar chart is a fork of this block by Mike Bostock: Canvas Bar Chart.