Skip to content

Instantly share code, notes, and snippets.

@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active March 20, 2025 19:02
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@caobug
caobug / UninstallShadowsocks.sh
Last active October 13, 2024 14:14
Uninstall shadowsocks from macOS
#/bin/bash
launchctl stop com.qiuyuzhou.shadowsocksX-NG.local
launchctl stop com.qiuyuzhou.shadowsocksX-NG.http
launchctl stop com.qiuyuzhou.shadowsocksX-NG.kcptun
sudo rm -rf /Applications/ShadowsocksX-NG*.app
sudo rm -rf /Library/Application\ Support/ShadowsocksX-NG
sudo rm -rf ~/Library/Application\ Support/ShadowsocksX-NG
sudo rm -rf ~/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.*
@ObserverOfTime
ObserverOfTime / css-inject.js
Last active March 3, 2024 04:46 — forked from 1j01/README.md
GitHub Desktop Dark Theme - NO LONGER MAINTAINED
/**
* To apply the theme:
* 1) Open dev tools with CTRL + SHIFT + I
* 2) Go to the console
* 3) Paste the following code
* Note: You will have to do this again whenever Github Desktop updates
*/
const fs = require('fs');
const path = require('path');
@mswieboda
mswieboda / osx-dark-mode-everything.md
Last active May 5, 2017 15:48
OS X Dark Mode Everything 🕶️ 🏴

OS X Dark Mode Everything 🕶️ 🏴

OS X Dark Menu Bar and Dock

System Preferences > General > Use dark menu bar and Dock

See if your menu bar icons can be switched to black, so they appear white for dark menu bar, most apps have an option in settings.

Chrome Extensions

@mswieboda
mswieboda / AltDBs.md
Last active October 14, 2016 19:52
Swap Rails development DBs with DATABASE_URL

Alt DBs ⚡️ Talk

Uses

Want to swap development databases? Sick of dropping, migrating and setting up databases when swtiching branches? This ⚡️ talk's for you!

Database Config Options

The sections Configuring a Database and Connection Preference in the Rails Guides explains that there are two ways to configure your DB.

require 'benchmark/ips'
module ExtraMath
def self.build_math(attr_name)
attr_name = attr_name.to_s
class_eval %Q{
def #{attr_name}(x)
x + x
end
}
@rgl
rgl / wait_for_http_200.sh
Last active February 18, 2025 11:37
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
@adamrecsko
adamrecsko / highlight.pipe.ts
Created May 1, 2016 20:28
Angular2 text highlight pipe
import {PipeTransform, Pipe} from 'angular2/core';
@Pipe({ name: 'highlight' })
export class HighLightPipe implements PipeTransform {
transform(text: string, [search]): string {
return search ? text.replace(new RegExp(search, 'i'), `<span class="highlight">${search}</span>`) : text;
}
}
/** Usage:
@nadav-dav
nadav-dav / dom2comp.js
Created March 15, 2016 10:37
React: Getting a component from a DOM element
let searchRoot = ReactDom.render(React.createElement(Main), document.getElementById('main'));
try {
var getComponent = (comp) => comp._renderedComponent ? getComponent(comp._renderedComponent) : comp;
var getComponentById = (id)=> {
var comp = searchRoot._reactInternalInstance;
var path = id.substr(1).split('.').map(a=> '.' + a);
if (comp._rootNodeID !== path.shift()) throw 'Unknown root';
while (path.length > 0) {
comp = getComponent(comp)._renderedChildren[path.shift()];
@mauvm
mauvm / Jasmine-and-Babel6.md
Created November 12, 2015 10:51
Jasmine ES6 run script for use with Babel 6
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
 "presets": ["es2015"]