Skip to content

Instantly share code, notes, and snippets.

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

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

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

require 'formula'
// Variables
// ––––––––––––––––––––––––––––––––––––––––––––––––
$base-font-size = 16px
$global-border-radius = 4px
//
// REM Calculator
//
// Calculates and returns the REM value based on PX input
let M = transformer#middle()
let S = transformer#source()
call transformer#cmd('Html2jade')
\.src(S.smart())
\.stream(
\ M.pipe('html2jade - --donotencode --bodyless'),
\ M.smart()
\)
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() {
@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.
*/
* {
@weblancaster
weblancaster / javascript-mobile-device-detection
Created May 15, 2014 20:38
Javascript Mobile device detection
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}
@nisaacson
nisaacson / .tern-project
Created February 26, 2014 17:23
Use tern with vim for node.js development.
{
"libs": [
"browser",
"underscore",
"jquery"
],
"plugins": {
"node": {}
}
}
@danharper
danharper / background.js
Last active February 13, 2026 12:47
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@kmaida
kmaida / convert-UNIX-timestamp.js
Last active January 2, 2025 21:01
Convert a UNIX timestamp to user's local time via JavaScript
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@atenni
atenni / README.md
Last active June 23, 2026 10:38
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]