Skip to content

Instantly share code, notes, and snippets.

@netpoetica
netpoetica / ios-select-fix.css
Last active April 10, 2025 19:00
iOS Disable User Select but Allow Input (Snippet)
/*
This is for demonstration purposes. Ideally, you should never use the star selector.
I recommend that you use this early on in your development, and then once you've established
your HTML element palette, go back and replace * with a comma-separated list of your
tag names. Additionally, the !important shouldn't have to be used, but I'm leaving it here
because some enterprising goons will probably copy and paste this directly into their project -
the !important will ensure these settings override other attempts that were either never
deleted or are part of an installed CSS file the user is unaware of.
*/
* {
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
let M = transformer#middle()
let S = transformer#source()
call transformer#cmd('Html2jade')
\.src(S.smart())
\.stream(
\ M.pipe('html2jade - --donotencode --bodyless'),
\ M.smart()
\)
// Variables
// ––––––––––––––––––––––––––––––––––––––––––––––––
$base-font-size = 16px
$global-border-radius = 4px
//
// REM Calculator
//
// Calculates and returns the REM value based on PX input

使用路由表实现分流
proxychains 最多只支持 64 条路由规则
因此使用 tsocks 而不是 proxychains

由于 brew tap adamv/alt 已不能使用,需要手动创建 Formula

创建 /usr/local/Library/Formula/tsocks.rb 内容如下

require 'formula'
@jbrooksuk
jbrooksuk / markdown.css
Created April 10, 2015 16:36 — forked from imjasonh/markdown.css
Ordered list
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@nhagen
nhagen / PromisAllWithFails.js
Last active December 23, 2025 06:42
Wait until all promises have completed even when some reject, with Promise.all
var a = ["sdfdf", "http://oooooolol"],
handleNetErr = function(e) { return e };
Promise.all(fetch('sdfdsf').catch(handleNetErr), fetch('http://invalidurl').catch(handleNetErr))
.then(function(sdf, invalid) {
console.log(sdf, invalid) // [Response, TypeError]
})
.catch(function(err) {
console.log(err);
})
@danharper
danharper / waitFor.js
Last active February 21, 2017 12:38
three ways to "waitFor" a prop to become non-null before rendering
// decorate the class, composition
function waitFor(prop) {
return ChildComponent => class extends Component {
render() {
return this.props[prop] ? <ChildComponent {...this.props} /> : null
}
}
}
// decorate the class, inheritance
@nevergiveup-j
nevergiveup-j / onerror
Last active June 12, 2018 06:09
前端代码异常日志收集与监控
/**
* @param {String} msg 错误信息
* @param {String} url 出错的文件
* @param {Long} line 出错代码的行号
* @param {Long} col 出错代码的列号
* @param {Object} error 错误的详细信息,Anything
*/
window.onerror = function(msg,url,line,col,error){
//没有URL不上报!上报也不知道错误
if (msg != "Script error." && !url){
@ericelliott
ericelliott / gitclean.sh
Created January 31, 2016 04:57
gitclean.sh - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin