Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
import socket | |
import struct | |
import json | |
def unpack_varint(s): | |
d = 0 | |
for i in range(5): | |
b = ord(s.recv(1)) | |
d |= (b & 0x7F) << 7*i | |
if not b & 0x80: |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
default: | |
@echo "Nothing to do..." | |
.PHONY: default | |
.SUFFIXES: | |
ifdef MP3_COVER | |
MP3_COVER_CMD = id3ted --APIC $(MP3_COVER) $@ | |
endif |
// vim: set et sw=2 ts=2 sts=2 ff=unix fenc=utf8: | |
// Author: Binux<[email protected]> | |
// http://binux.me | |
// Created on 2013-01-21 20:18:42 | |
jQuery.ajax({ | |
url: 'http://pyproxy.duapp.com/http://httpbin.duapp.com/cookies/set?userid=21', | |
cache: true, | |
dataType: 'script', | |
success: function() { |
Y组合子是Lambda演算的一部分,也是函数式编程的理论基础。 | |
它是一种方法/技巧,在没有赋值语句的前提下定义递归的匿名函数。 | |
即仅仅通过Lambda表达式这个最基本的“原子”实现循环/迭代。 | |
颇有道生一、一生二、二生三、三生万物的感觉。 | |
虽然Y组合子在理论上很优美,但在实际开发中并不会真的用到。 | |
想要了解Y组合子是什么,请参见维基百科:http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator | |
或者知乎上的回答:http://www.zhihu.com/question/20115649 |
<?php | |
function sinaWburl2ID($url) { | |
$surl[2] = str62to10(substr($url, strlen($url) - 4, 4)); | |
$surl[1] = str62to10(substr($url, strlen($url) - 8, 4)); | |
$surl[0] = str62to10(substr($url, 0, strlen($url) - 8)); | |
$int10 = $surl[0] . $surl[1] . $surl[2]; | |
return ltrim($int10, '0'); | |
} |
--title 用 Ruby 构建碉堡的命令行应用程序 | |
--author 马陆骋(Teddy-Ma@github Teddy@ruby-china) | |
--date today | |
--center <Build Awesome Command Line applications in Ruby2> 读书笔记 | |
--center For absolute beginners | |
--center And some little examples | |
--newpage main | |
--heading Command Line Application |
They say that one of the pros of NodeJS is that you use the same language on the back-end and the front-end, so it's easy to share code between them. This sounds great in theory, but in practice the synchronous dependency handling in NodeJS works completely different than any client-side frameworks (which are asynchronous).
Usually that means that you end up copy-pasting your code between your NodeJS sources and your client-side sources, or you use some tool like Browserify, which is brilliant, but they add an extra step in the build process and most likely will conflict with the dependency handling of the framework of your choice (like AnularJS DI). I couldn't look in the mirror if I would call that code sharing.
Fortunately, with a couple of lines of boilerplate code, you can write a module which works in NodeJS and AngularJS as well without any modification.
No globals in the front-end, and dependencies will work. The isNode and isAngular va
#!/bin/bash | |
# | |
# Set up OSX preferences | |
# | |
# Inspired by: https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
########################################### | |
# CONFIG | |
HOSTNAME="machiavellia" | |
TIMEZONE="America/Chicago" # 'systemsetup -listtimezones' |
drowning.svg : drowning.dot | |
dot -Tsvg drowning.dot > drowning.svg | |
drowning.dot : drowning.js | |
node drowning.js > drowning.dot |