Skip to content

Instantly share code, notes, and snippets.

View GeekaholicLin's full-sized avatar
💭
I may be slow to respond.

void GeekaholicLin

💭
I may be slow to respond.
View GitHub Profile
@GeekaholicLin
GeekaholicLin / config_virtualbox_xxnet.md
Last active September 9, 2018 13:50
virtualbox 共享host os的xx-net

最怕的就是各种配置,每次都得搜索很多,不断地折腾。

今天遇到了将本机的xx-net和虚拟机中的系统共享网络的需要,其实这个并不难。比如,在virtualbox中的网络设置,将网络模式设置为NAT连接就好。

但是,无论怎么设置都不能使得virtualbox中的Linux Mint共享XX-NET翻墙,也就是说不能在virtualbox宿主机器里面进行Google搜索

经过一番搜索,终于解决了,记下来,以方便以后自己或者遇到相同的问题的小伙伴。

    1. 设置xxnet为局域网共享状态。具体做法为:在XX-Net\data\gae_proxy目录下,备份config.iniconfig.ini.bak,然后编辑config.ini,部分设置如下。
@GeekaholicLin
GeekaholicLin / vim8_build.md
Last active October 26, 2019 08:48
WLS Ubuntu 18 编译 vim8

相关命令:

# 移除原有的
sudo apt-get remove vim vim-runtime gvim

# 依赖安装
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
@GeekaholicLin
GeekaholicLin / babun_config.md
Last active January 15, 2017 17:18
babun config:change the investigate.vim plug to work in babun's vim
" Return the executable tool for documentation opening ------ {{{
function! s:Executable()
  if has("mac")
    if executable("open")
      return "open "
    elseif executable("/usr/bin/open")
      " Return full path if Vim's path isn't setup correctly
      return "/usr/bin/open "
 else
@GeekaholicLin
GeekaholicLin / arr_len_detect.md
Created January 3, 2017 11:49
数组长度变化监听
var arrayChangeHandler = {
  get: function(target, property) {
    return target[property];
  },
  set: function(target, property, value, receiver) {
    if(property==="length") target[property] = value,console.log("长度改变!长度为:"+value);
    // you have to return true to accept the changes
 return true;
@GeekaholicLin
GeekaholicLin / twos.md
Created December 31, 2016 03:02
判断是否是2的幂次
function isTwoS(input){
  var result = input&(input-1);
  console.log(result===0);
}
isTwoS(8);

使用按位与进行判断。

@GeekaholicLin
GeekaholicLin / typeof & Object.prototype.toString.md
Last active December 10, 2016 06:25
如何正确判断Javascript中的类型
var reg1 = /^.*&/;
var reg2 = new RegExp();
var str1 = "str1";
var str2 = new String("str2");
var num1 = 1234;
var num2 = new Number(1234);
var bool1 = true;
var bool2 = new Boolean(true);
var bool3 = Boolean(1);
@GeekaholicLin
GeekaholicLin / call&apply.md
Last active December 9, 2016 07:04
call和apply参数的区别
var arr = [5, 6, [1, 2], [3, 4]];
console.log(Array.prototype.concat.call([], arr));     // [5, 6, [1, 2], [3, 4]]
console.log(Array.prototype.concat.apply([], arr));    // [5, 6, 1, 2, 3, 4]
@GeekaholicLin
GeekaholicLin / arguments_slice.md
Last active December 6, 2016 13:59
如何将arguments转换为参数数组--javascript

问题的由来

在看js编程风格的时候,遇到了一个比较常见的问题:

使用 Array#slice 将类数组对象转换成数组。

function trigger() {
  var args = Array.prototype.slice.call(arguments);
  ...
}
@GeekaholicLin
GeekaholicLin / iframe.md
Last active December 2, 2016 13:09
bug-and-solution-2016.12.2

在使用iframe对一些页面进行套用的时候,比如 https://book.douban.com/tag/ ,由于该页面的js原因,总是将嵌套的主页自动跳转到该页面。这样就无法 在原来的主页正常工作。解决方法是

<iframe sandbox=”allow-forms allow-same-origin allow-scripts” src=”...”></iframe> 这样,就可以保证js脚本的执行,但是禁止iframe里的javascript执行top.location = self.location。


参考链接

@GeekaholicLin
GeekaholicLin / bool.md
Created November 27, 2016 07:21
【转】如何优雅地判断 N 个布尔值是否全部相等?