Skip to content

Instantly share code, notes, and snippets.

View neekey's full-sized avatar
🎯
Focusing

Neekey neekey

🎯
Focusing
View GitHub Profile
@neekey
neekey / use-node-open-terminal.md
Created May 10, 2013 04:19
在nodeJS中启动一个teminal窗口执行相关进程

Mac

使用open 命令,调用terminal来打开abc这个文件:

open -a /Applications/Utilities/Terminal.app "abc"

期中-a这个参数保证打开一个新的terminal实例

@neekey
neekey / gist-blog_AWS-free-trier-connetc-SSH-install-nodejs.md
Last active December 15, 2015 21:29
AWS试用:SSH联接&安装NodeJS

最近有试用VPS的需求,但是价格稍微有点贵,于是想到不如使用一下AWS(Amazon Web Services)。

关于基本的注册之类的这里不做介绍,主要记录下,当创建玩一个instance后,如何开始使用吧:

连接SSH

首先在创建Instance(其实就是一台机器,你可以根据自己需要在配置的时候选好什么操作系统啊之类的)时,就会设置好一个SSH的.pem文件,下载到本地,存好。

然后启动你的Instance(开机),并且在instance面板中,右键你的机器,选贼connect,然后在出现的复层中选中第一项,你就会看到关于SSH连接的相关命令了。

@neekey
neekey / apart_html_js.html
Created March 26, 2013 07:59
让HTML和Javascript保持分离
<!DOCTYPE html>
<html>
<head>
<title>title</title>
</head>
<body>
<form>
<input type="text" name="name" id="my-name" placeholder="输入您的姓名" />
<button type="submit" id="submit-form">提交</button>
</form>
@neekey
neekey / gist-blog-ignore-files-to-be-watch-in-meteor.md
Created March 9, 2013 08:37
设置Meteor动态更新服务忽略文件

项目目录中有很多文件我们是不需要监控其文件变更并重新部署的,因此有一个简单的方式是,将哪些需要忽略文件变更的文件放在'~'结尾的目录下...

@neekey
neekey / gist-blog-use-node-module-with-meteor.md
Created March 9, 2013 08:31
在Meteor中使用node.js的模块系统

这是Meteor的大坑,希望以后这块能做的更好。

首先,在Meteor中,由于经过了沙箱的封装,无法直接触碰到require, module等全局变量。

且,Meteor会自动执行所有不在testpublic目录下的js文件,因此我们需要使用的npm模块都需要安装到public目录下。

然后使用meteor-node-module进行模块的加载。

举例,我们现在需要使用mustache,那么cdpublic目录下,安装之npm install mustache,然后在我们的代码中使用:

@neekey
neekey / gist-blog-sync-run-within-meter-methods.md
Created March 9, 2013 08:23
在Meter.methods()中进行异步操作

相关issue: meteor/meteor#74 (comment)

方法是使用fiber模块来实现同步阻塞。

首先先利用该模块封装一个同步执行方法:

syncRun = function(func) {
    var Fiber = NodeModules.require( 'fibers' );
 var fiber = Fiber.current;
@neekey
neekey / git-m.sh
Created March 4, 2013 04:05
Git-m to changed the git history author info
#!/bin/bash
#----changed the git history author info---
#---see http://baike.corp.taobao.com/index.php/Git-m --
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
txtrst='\e[0m' # Text Reset
function warning (){
echo -n -e "${bldylw}WARNING:"
echo -n -e "${txtrst}"
echo $1

Mac自带的Boot Camp程序,可以非常便利地帮助用户在Mac电脑上同时安装一个Windows系统。针对Macbook Air用户,这里记录下在没有光驱的情况下,使用USB制作启动盘来安装Windows的过程。

需要准备的物品:

1、U盘一个(>= 4g) 2、win7镜像文件(.iso) 3、rEFIT.dmg(用于让不支持USB等外设设备启动引导的设备能识别USB设备启动)

制作启动盘

@neekey
neekey / sass_add_extend_only_dynamically.scss
Last active December 11, 2015 22:29
动态添加class,并统一输出样式
$btnSizeClassPrefix: "%btn-size-";
$btnStyleClassPrefix: "%btn-style-";
@mixin addButtonSizeClass( $names... ){
$selector: listToString( $names, ",", $btnSizeClassPrefix );
#{$selector} {
@content;
}
@neekey
neekey / gist-blog-cleanup_install_ruby_manually.md
Last active February 2, 2021 13:15
Mac下手动清理/安装Ruby

本文介绍如何在Mac OSX下手动清理和安装Ruby。献给所有不怎么懂Ruby,但是又时常为Ruby纠结的人。

清理

所谓清理的话,其实只要看看Ruby在安装的时候做了什么就好了。好在Ruby自己源码安装的时候很体贴地会把自己干的事情总结出来:

installing binary commands:   /usr/local/bin
installing base libraries:    /usr/local/lib
installing arch files:        /usr/local/lib/ruby/1.9.1/x86_64-darwin12.2.0