[gist]用 jest 轻松测试 JavaScript

2014-08-22
阅读 5 分钟
3.3k
from oyanglul.us Javascript 的测试, 不管在用 jasmine 还是 mocha, 都是很头疼的事情. 但是自从有了 jest, 一口气写7个测试, 腰也不疼了, 头也不疼了. 只需要 3 个理由 在说用 jest 测为什么好之前,我们先来看我们要测的一个例子. 栗子 比如我要写一个模块要去取github 用户的follower 和他所有 repo 的 follower 数量...

[gist]Introduces $.oauth() to make using OAuth from jQuery as easy as using $.ajax()

2014-08-17
阅读 4 分钟
2.5k
from [链接] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 (function (window, document, $, undefined) { if (!$.Deferred) throw 'jQuery 1.5 is required t...

[gist]<div id="gist6376327" class="gist"> <div&hellip;

2014-08-17
阅读 1 分钟
2.3k
from [链接] 1 [x/2 for x in range(2,10,2)] view raw code_retreat_in_python hosted with ❤ by GitHub

[gist]simple use of closure

2014-08-17
阅读 1 分钟
2.1k
from [链接]

[gist]pure and secure javascript oauth with yql

2014-08-17
阅读 7 分钟
2.9k
It would be awesome if we can use OAuth in JavaScript purely in client side. before start to do that, please let me explain “OAuth2” with this picture in feeeew word (skip to section 2 YQL if you know OAuth2):

[gist]How to use Mock testing Python

2014-08-17
阅读 2 分钟
2.5k
patch 一个导入 module 的 method, 因为 method 已经被导入到目标文件, 因此必须 要 patch 目标文件的 该方法, 而不是原 module.

[gist]How to Write Post Using Octopress Travis CI and Org Mode

2014-08-17
阅读 10 分钟
3.1k
Github page 上建博客本来就是很geek的事情, 用octopress来建博客可用说是 for ruby geeks, 因为可以用欢乐的rake &lt;task&gt; 来完成建立文章和发布等一系 列task. 当然他依赖于 Jekyll

[gist]快速开发android应用

2014-08-17
阅读 7 分钟
3.5k
最近再一次偶然的机会在github上见到了这样一个repo [链接] 能让你迅速搭建起基本ui和框架.但是基本上没有什么文档,非常可惜.环境搭好 了,却不知道在哪里加代码. 于是我玩几天准备把我的理解写一下,以供找不到文 档的同学可以快速上个手.

[gist]Evernote with emacs and org-mode

2014-08-17
阅读 2 分钟
3k
patch 一个导入 module 的 method, 因为 method 已经被导入到目标文件, 因此必须 要 patch 目标文件的 该方法, 而不是原 module.

[gist]emacs auto config

2014-08-17
阅读 1 分钟
2.2k
有同学问初学该有个什么starter-kit之类的, 虽然我之前也在用 emacs-starter-kit, 但是那玩意其实对 emacs 24 来说已经很鸡肋了. emacs 24 对包管理这块做的已经足够好,而且源也足够多, 因此, 配置 emacs 24 会变 得容易的多.

[gist]Why Promises will make async easy

2014-08-17
阅读 4 分钟
2.1k
Promise is a proxy for a value not knowing when its creation time. It provide 2 Methods then and catch, which return promise so they can be chained.

[gist]BDD using jasmine jquery

2014-08-17
阅读 4 分钟
6.4k
参加 TWU 时写 jasmine 测试的时候花了大量时间研究为什么不能绑定事件到 fixture. 这导致 teamate 和我自己都会认为我这个带头引入这么难用的 jasmine 的人简直是要杀千刀. 但是其实问题不是 jasmine 当然也不是我, 都是 jasmine-jquery

[gist]为什么事件驱动服务器这么火

2014-08-17
阅读 6 分钟
3.3k
传统服务器模型如Apache为每一个请求生成一个子进程。当用户连接到服务器的一个子进程就产生,并处理连接。每个连接获得一个单独的线程和子进程。当用户请求数据返回时,子进程开始等待数据库操作返回。如果此时另一个用户也请求返回数据,这时就产生了阻塞。

[gist]flash dd-wrt and install transmission in WNR2200 router

2014-08-17
阅读 4 分钟
2.8k
USB disk 格式化成ext2/3格式, with gparted in linux. 根据官方wiki, 最新的v24已经 不用jffs了, 目前的dd-wrt目录结构是这样的:

[gist]the atom workspaceView events

2014-08-17
阅读 7 分钟
2.9k
from [链接] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...

[gist]Build Yourself a Backbone.js Step by Step

2014-08-17
阅读 14 分钟
3.4k
from [链接] Install Node brew install node node here is use for setup tools like grunt and mocha npm install -g grunt grunt is js build tool. npm install -g bower bower is package management for frontend js. Install Dependencies npm install this will install all dependecies under package.json {代...

[gist]为什么要柯里化(curry)

2014-08-17
阅读 2 分钟
3.3k
多巧啊, 人家姓 Curry 名 Haskell, 难怪 Haskell 语言会自动柯里化, 呵呵. 但是不奇怪吗, 为什么要柯里化呢. 为什么如此重要导致 Haskell 会默认自动柯里化所有函数, 不就是返回一个部分配置好的函数吗.

[gist]connect cisco anyconnect in terminal

2014-08-17
阅读 1 分钟
2.5k
from [链接] 1 2 3 4 5 6 7 8 #/bin/sh/opt/cisco/anyconnect/bin/vpn -s $1 mel-vpn.realestate.com.au &lt;&lt;"EOF"0your.nameyour.passwordyexitEOF view raw vpn hosted with ❤ by GitHub

[gist]Why do we still need Evernote since there is awesome gist.github.com

2014-08-17
阅读 1 分钟
2.5k
I'm a Emacs user and as you may know there is a awesome mode called gist.el, and since then, I found that it's completely my Evernote replacement. Why replace Evernote with gist?

[gist]<div id="gist13740541" class="gist"> <div&hellip;

2014-08-17
阅读 1 分钟
2k
from [链接] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 var Request = require("sdk/request").Request; var request = function(url, method, data){ var res = $.Deferred(); Request({ url: url, content: data, onComplete: function (response) { res.resovle(response.json); } })[method](); return res; }  module.expo...

[gist]moz-request.js

2014-08-17
阅读 1 分钟
1.9k
from [链接] {代码...}

你造 Promise 就是 Monad 吗

2014-07-22
阅读 6 分钟
7.4k
Monad 这个概念好难解释, 你可以理解为一个 Lazy 或者是状态未知的盒子. 听起来像是薛定谔猫(估计点进去你会更晕了). 其实就是的, 在你打开这个盒子之前, 你是不知道里面的猫处在那种状态.

使用 mock 测试 python 应用

2014-05-15
阅读 2 分钟
5k
patch 一个导入 module 的 method, 因为 method 已经被导入到目标文件, 因此必须 要 patch 目标文件的 该方法, 而不是原 module.