Skip to content

Instantly share code, notes, and snippets.

尹良灿 wenLiangcan

  • China
Block or report user

Report or block wenLiangcan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wenLiangcan
wenLiangcan / num.md
Created Jan 3, 2015
匹配中国手机号的正则
View num.md
View .ctags
--langdef=moonscript
--langmap=moonscript:.moon
--regex-moonscript=/(^|=[ \t])*class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( extends ([A-Za-z][A-Za-z0-9_.]*)+)?$/\3/c,class/
--regex-moonscript=/^[ \t]*@?(([A-Za-z][A-Za-z0-9_.]*)+):.*[-=]>.*$/\1/m,method/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=.*[-=]>.*$/\1/f,function/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/v,variable/
--regex-moonscript=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/p,property/
--regex-moonscript=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/s,static property/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/p,property/
--regex-moonscript=/(new:[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?/\3/p,property/
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

View drp.py
#!/usr/bin/env python
"""
Upload image to http://drp.io in terminal.
"""
from __future__ import print_function
import sys
@wenLiangcan
wenLiangcan / drain.py
Created Aug 31, 2014
脱水豆瓣小组话题
View drain.py
#!/usr/bin/env python3
import os
import re
import sys
import mechanicalsoup
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36'
View Image Clipboard To File.md

Introduction

Saves an image from clipboard to a file.

Dependencies:

  • python2
  • PyGTK

Installation

View read_torrent.py
import os.path
import sys
import time
import torrent
def get_meta(path):
f = open(path, "r")
s = f.read()
View prun.py
#! /usr/bin/env python
#coding=utf-8
import gevent
from gevent.subprocess import Popen, PIPE
import sys
def run(cmd,name="",index=1,color=True):
fc = 32 + index%5
if name:
@wenLiangcan
wenLiangcan / pyv.py
Created Jul 18, 2014
Find out-of-date modules
View pyv.py
import json
from distutils.version import LooseVersion
import pip
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
View mag2bt.py
#!/usr/bin/env python
import re
import sys
if sys.version_info[0] == 2:
import urllib2
import urllib
import urlparse
input = raw_input
You can’t perform that action at this time.