Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| package com.tomgibara.android.util; | |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| /** | |
| * A layout that arranges views into a grid of same-sized squares. |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| PREFIX=`pwd`/protobuf/android | |
| rm -rf ${PREFIX} | |
| mkdir ${PREFIX} | |
| export NDK=YOUR_NDK_ROOT | |
| # 1. Use the tools from the Standalone Toolchain | |
| export PATH=YOUR_NDK_STAND_ALONE_TOOL_PATH/bin:$PATH | |
| export SYSROOT=YOUR_NDK_STAND_ALONE_TOOL_PATH/sysroot |
| M[16],X=16,W,k;main(){T(system("stty cbreak") | |
| );puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i | |
| ,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M | |
| [w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<< | |
| (l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k) | |
| ]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d | |
| -1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X] | |
| *i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4; | |
| )s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4|| | |
| puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2 |
| var xor = [ | |
| [[0, 0], [0]], | |
| [[0, 1], [1]], | |
| [[1, 0], [1]], | |
| [[1, 1], [0]] | |
| ]; | |
| var iris = [ | |
| [[5.1, 3.5, 1.4, 0.2], [1]], | |
| [[4.9, 3.0, 1.4, 0.2], [1]], |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /* | |
| * Copyright (C) 2014 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| /* | |
| * Copyright (C) 2014 skyfish.jy@gmail.com | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| { | |
| @Override | |
| public Map<String, String> getHeaders() throws AuthFailureError { | |
| Map<String, String> headers = super.getHeaders(); | |
| Map<String, String> newHeaders = new HashMap<String, String>(); | |
| newHeaders.putAll(headers); | |
| newHeaders.put("User-Agent", "Mozilla/5.0"); | |
| return newHeaders; | |
| }; | |
| } |