Skip to content

Instantly share code, notes, and snippets.

View yesmeck's full-sized avatar
:octocat:
<img src="x" onerror="alert(1)" />

Wei Zhu yesmeck

:octocat:
<img src="x" onerror="alert(1)" />
View GitHub Profile
@yesmeck
yesmeck / toolbar.js
Created January 4, 2021 05:49
Kitchen toolbar
const agentView = NSStackView.alloc().init();
const container = NSView.alloc().initWithFrame(NSMakeRect(0, 0, UI.TOOLBAR_DEFAULT_WIDTH, 400));
container.identifier = pluginConstant.BAR_CONTAINER;
container.addSubview(agentView);
const viewsDictionary = { container, stack: agentView };
const horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat_options_metrics_views(
'H:|-0-[stack]-0-|',
0,
nil,
JavaScript 9 hrs 11 mins ███████▉░░░░░░░░░░░░░ 38.0%
TypeScript 8 hrs 29 mins ███████▍░░░░░░░░░░░░░ 35.1%
JSON 2 hrs 41 mins ██▎░░░░░░░░░░░░░░░░░░ 11.2%
Other 1 hr 44 mins █▌░░░░░░░░░░░░░░░░░░░ 7.2%
Markdown 34 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.4%
@yesmeck
yesmeck / bundle.js
Last active September 21, 2017 03:57
redundant __webpack_require__
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
@yesmeck
yesmeck / detect-port
Created June 5, 2017 08:57
detect which command using port
#!/bin/sh
port=$1
pid=`lsof -i :${port} -P -t -sTCP:LISTEN`
dir=`lsof -p ${pid} | awk '$4=="cwd" {print $9}'`
cmd=`ps -o command -p ${pid} | sed -n 2p`
echo "${cmd} in ${dir}"
@yesmeck
yesmeck / fixit.sh
Last active March 9, 2017 03:19
Fix your js project!
#!/bin/sh
COLOR_GREEN='\033[0;32m'
echo "${COLOR_GREEN}Remove node_modules."
rm -rf node_modules
echo "${COLOR_GREEN}Remove yarn.lock."
rm -f yarn.lock
if command -v ayarn > /dev/null 2>&1; then
echo "${COLOR_GREEN}Install node_modules use ayarn."
@yesmeck
yesmeck / gist:947d19a82360c764d3e6
Created January 29, 2016 13:37 — forked from ebuildy/gist:5d4ad0998848eaefdad8
Setup sentry logger on a fresh Ubuntu server
sudo apt-get update
sudo apt-get install python-virtualenv libxslt1-dev libxml2
sudo apt-get install python-dev
sudo apt-get install postgresql
sudo apt-get install postgresql-server-dev-9.3
sudo apt-get install redis-server
sudo -u postgres createuser -s sentry
sudo -u postgres psql -c "alter user sentry with password 'sentry';"
@yesmeck
yesmeck / tool.md
Last active December 23, 2015 14:18
React 测试工具

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@yesmeck
yesmeck / why_normalizr.md
Last active October 30, 2015 19:35
Normalizr 的意义

假设有个 API /articles 返回的结构如下:

articles: article*

article: {
  author: user,
  likers: user*
  primary_collection: collection?
  collections: collection*
}
@yesmeck
yesmeck / ngEnter.js
Last active September 2, 2015 09:11 — forked from EpokK/ngEnter.js
ngEnter directive if you can use submit form(https://twitter.com/ririlepanda)
app.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) {
scope.$apply(function(){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}