This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deriving the Y Combinator in 7 Easy Steps | |
December 01, 2010 | |
The Y Combinator is a method of implementing recursion in a programming language that does not support it natively (actually, it's used more for exercising programming brains). The requirement, though, is that language to support anonymous functions. | |
I chose JavaScript for deriving the Y Combinator, starting from the definition of a recursive factorial function, using a step-by-step transformation over the initial function. | |
Update | |
There's now a Chinese translation of this article as well as a Clojure port. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var y = le => (f => f(f)) (f => le(x => (f(f))(x))) | |
var y = function(le) { | |
return function(f) { | |
return f(f); | |
}(function(f) { | |
return le( | |
function(x) { return (f(f))(x); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = [ | |
'Cras justo odio', | |
'Dapibus ac facilisis in', | |
'Morbi leo risus', | |
'Porta ac consectetur ac', | |
'Vestibulum at eros' | |
] | |
var list_set = function () { | |
list.push('Item '+ new Date().getTime()); | |
$('#list').trigger('update:list'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker 部署 gitlab | |
`wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml && docker-compose up -d ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $seach, $list; | |
$seach = $('#seach'); | |
$list = $('#list'); | |
$seach.on('keydown', function(){ | |
var $this = $(this); | |
setTimeout(function(){ | |
var val = $this.val(); | |
var re = new RegExp(val); | |
var newlist = $list.find('li').filter(function(item){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var roc = { | |
namespace: function(ns) { | |
var parts = ns.split('.'), | |
object = this, | |
i, len; | |
for (i=0, len=parts.length; i < len; i++) { | |
if (!object[parts[i]) { | |
object[parts[i]] = {}; | |
} | |
object = object[parts[i]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
// sass 插件 | |
var sass = require('gulp-sass'); | |
// 自动同步浏览器插件 | |
var browserSync = require('browser-sync'); | |
// 合并文件的插件 | |
var useref = require('gulp-useref'); | |
// 压缩js插件 | |
var uglify = require('gulp-uglify'); | |
var gulpIf = require('gulp-if'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>我的生活</title> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/emmetio/emmet-atom/issues/354 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Table with Persistent Headers</title> | |
<link rel="stylesheet" href="css/style.css"> | |