3 common building blocks of functional language
-
Filter Use filter to produce a subset of a collection based on supplied filtering criteria.
-
Map
| # requirements: | |
| # beautifulsoup4==4.3.2 | |
| # uniout==0.3.7 | |
| import sys | |
| import urllib2 | |
| import re | |
| import uniout | |
| from bs4 import BeautifulSoup | |
| from pprint import pprint |
| #!/bin/bash | |
| TAIL=`which tail` | |
| AWK=`which awk` | |
| if [[ -z $TAIL ]]; then | |
| echo -e "Cannot find tail executable.\n" | |
| exit 1 | |
| fi | |
| if [[ -z $AWK ]]; then | |
| echo -e "Cannot find awk executable.\n" | |
| exit 1 |
git diff // Look diff from previous commited version
git diff > temp.patch // Output diff to patch file
git apply temp.patch // Apply patch 'pk_xxx'
git reset --hard 6a137 // Force reset to version '6a137' will lost new commit
git format-patch HEAD^^^ // Patch to nth(^) previos version from HEAD, output multiple files
| [user] | |
| name = <Your Name> | |
| email = <Your Emain> | |
| [core] | |
| excludesfile = ~/.gitignore | |
| pager = less -FXrS -x4 | |
| filemode = false | |
| whitespace = cr-at-eol | |
| editor = vim |
###Workaround for welcome latter
Subscribe the user to List
ListSubscribeMethod req1 = new ListSubscribeMethod();
req1.apikey = API_KEY;
req1.id = LIST_ID;
req1.email_address = "xxxx@gmail.com";
// There is no need to send confirm letter
req1.double_optin = false;
| #include <cmath> | |
| #include <vector> | |
| #include <iostream> | |
| using namespace std; | |
| // greedy | |
| int minCoins_greedy(vector<int> a, int sum) { | |
| sort(a.begin(), a.end(), greater<int>()); // sorted in descending order | |
| a.erase(unique(a.begin(), a.end()), a.end()); // remove duplicates |
| /* --- Usage --- */ | |
| g++ server.c -o server | |
| g++ client.c -o client | |
| ./server | |
| ./client 127.0.0.1 | |
| /* --- server.c --- */ | |
| #include <sys/socket.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> |
| Chap5. BufferQueue 和 Comsumer 的關係 | |
| void Layer::onFirstRef() | |
| { | |
| struct FrameQueuedListener : public SurfaceTexture::FrameAvailableListener { | |
| FrameQueuedListener(Layer* layer) : mLayer(layer) { } | |
| private: | |
| wp<Layer> mLayer; | |
| virtual void onFrameAvailable() { |
| #include <iostream> | |
| using namespace std; | |
| class Base { | |
| private: | |
| int a; | |
| int privMethod() { return a; } |