Skip to content

Instantly share code, notes, and snippets.

Avatar

Yongkang Chen yongkangchen

View GitHub Profile
@yongkangchen
yongkangchen / INSTALL.markdown
Last active Aug 29, 2015 — forked from Suor/INSTALL.markdown
sublimetext open file at cursor
View INSTALL.markdown

Open keyboard bindings file, and add a line to it

[
    ...
    { "keys": ["alt+o"], "command": "open_file_at_cursor" } // this one
]
@yongkangchen
yongkangchen / LuaParseCheck.py
Created May 19, 2014
lua syntax check when save lua file in sublime
View LuaParseCheck.py
import sublime, sublime_plugin
import os
import re
regex = re.compile('.*:(\d+):.*')
class LuaParseCheck(sublime_plugin.EventListener):
def on_post_save_async(self, view):
path = view.file_name()
if os.path.splitext(path)[-1] != ".lua":return
result = os.popen("/usr/local/bin/luac -p '"+path+"' 2>&1").read()
View git-svn.md

$ svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /' > users.txt

$ vi users.txt

$ git svn init ${svn_url} --no-metadata

$ git svn fetch --authors-file=users.txt

$ vi .gitignore

@yongkangchen
yongkangchen / test.cs
Created May 14, 2015
How does Unity null all references to a GameObject after Object.Destroy is called on it?
View test.cs
using UnityEngine;
public class Main : MonoBehaviour {
void Start ()
{
FakeObject obj = new FakeObject ();
Debug.LogError (obj); // [FakeObject]
Debug.LogError (obj == null); // false
Debug.LogError (obj.num); //100
View bad_output_linux.txt
---- TRACE 1 start vector3.lua:14
0008 UGET 5 0 ; Vector3
0009 KSHORT 6 0
0010 KSHORT 7 1
0011 KSHORT 8 0
0012 CALL 5 2 4
0000 . FUNCF 7 ; vector3.lua:6
0001 . UGET 4 0 ; setmetatable
0002 . TNEW 5 4
0003 . ISTC 6 1
View install-shadowsocks.sh
#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
useradd shadowsocks
read -p "input shadowsocks password: " SS_PASSWORD
CONFIG_FILE=/etc/shadowsocks.json
SERVICE_FILE=/etc/systemd/system/shadowsocks.service
@yongkangchen
yongkangchen / ctags lua 规则增强
Last active Dec 12, 2018
ctags lua 规则增强
View ctags lua 规则增强
--regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+):([a-zA-Z0-9_]+).*$/\2/f,function/
--regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+).*$/\2/f,function/
--regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\s*\(.*$/\1/f,function/
--regex-LUA=/([a-zA-Z0-9_]+) = require[ (]"([^"]+)"/\1/r,require/
--regex-LUA=/[ \t]{1}([a-zA-Z0-9_]+)[ \t]*[=][^=]/\1/v,variable/
--regex-LUA=/[ \t]*([a-zA-Z0-9_]+)[ \t]*=[ \t]*module_define.*$/\1/m,module/
--regex-LUA=/func_table\[ msg\.([A-Z_]+) \].+/\1/
@yongkangchen
yongkangchen / atom.js
Last active Dec 12, 2018
boom!!! Here is a hack solution to make atom start faster. For Atom <= v0.170.0
View atom.js
Atom.prototype.startEditorWindow = function() {
var CommandInstaller, dimensions, maximize, resourcePath, safeMode, _ref;
_ref = this.getLoadSettings(), resourcePath = _ref.resourcePath, safeMode = _ref.safeMode;
CommandInstaller = require('./command-installer');
CommandInstaller.installAtomCommand(resourcePath, false, function(error) {
if (error != null) {
return console.warn(error.message);
}
});
CommandInstaller.installApmCommand(resourcePath, false, function(error) {
You can’t perform that action at this time.