Skip to content

Instantly share code, notes, and snippets.

View xwartz's full-sized avatar
🎯
Focusing

xwartz xwartz

🎯
Focusing
View GitHub Profile
@seeliang
seeliang / lint-only-changed-files.MD
Last active April 10, 2024 09:44
How to lint only changed files?

find out the differences

use git diff to generate file list

git diff --name-only master

limited to certain file types

add ext filter

@kaichen
kaichen / luxe-ens-management.md
Last active November 6, 2018 06:25
how to integrate with luxe IANA

luxe ens managment

data structure:

mapping(uint=>mapping(address=>bool)) public registrars; // Maps IANA IDs to authorised accounts
mapping(bytes32=>uint) public nonces; // Maps namehashes to domain nonces

keep track mapping of user id and ethereum address, and domain nonce

anonymous
anonymous / Debian_OpenVPN_MysteriumNetwork
Created May 19, 2017 05:31
Debian 8 部署 Mysterium Network Node(密链网络节点)
下面方法在 Debian 8 已通过 Mysterium 服务器端部署,Ubuntu 14.04+ 应该也没问题。
OpenVPN 安装参考官方文档,建议安装新版 2.4.2 (多谢 @Shacl0w 提醒)
https://community.openvpn.net/openvpn/wiki/OpenvpnSoftwareRepos#InstallingOpenVPN
安装 Mysterium Node
$ wget https://github.com/MysteriumNetwork/node/releases/download/0.0.6/mysterium-node_linux_amd64.deb
@brennanMKE
brennanMKE / EventEmitter.swift
Last active March 7, 2024 04:04
React Native Event Emitter for RCTEventEmitter in Objective-C and Swift
class EventEmitter
/// Shared Instance.
public static var sharedInstance = EventEmitter()
// ReactNativeEventEmitter is instantiated by React Native with the bridge.
private static var eventEmitter: ReactNativeEventEmitter!
private init() {}
@imjared
imjared / lime.sh
Created September 22, 2016 02:02
#!/bin/bash
projectFile=$(find $1 -name "*.sublime-project" -maxdepth 1)
echo $projectFile
if [ $projectFile ]
then
subl $projectFile
else
subl $1
fi
@cybrown
cybrown / bignumber.js.d.ts
Created January 9, 2016 15:18
Starting web3 TypeScript type definition
declare module "bignumber.js" {
class BigNumber {
constructor(value: number|string); // Acccepts a number OR a string
toNumber(): number;
// Those static attributes could have been in the module, a few lines beneath
static ROUND_DOWN: any;
static config(arg: any): void;
}
@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 05:08
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@xwartz
xwartz / pubsub.js
Created September 4, 2015 17:08
发布订阅模式
var PubSub = {
// 订阅函数
subscribe: function (event, callback) {
// 创建事件存储对象
this._events = this._events || {}
// 添加回调函数
this._events[event] = this._events[event] || []
this._events[event].push(callback)
// 链式调用
return this
@max-mykhailenko
max-mykhailenko / # Sublime Emmet JSX Reactjs.md
Last active November 25, 2022 23:25
Sublime text 3. Enable Emmet in JSX files with Sublime React plugin

This is no longer needed as Emmet supports JSX - you just need to turn it all on. Did a quick tutorial: http://wesbos.com/emmet-react-jsx-sublime/

Thanks, @wesbos

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed