Skip to content

Instantly share code, notes, and snippets.

var http = require("http")
// var util = require("util")
var EventEmitter = require("events").EventEmitter
//============ version 1 ==============
var Ticker = function () {
setInterval(()=>{
console.log("tick")
this.emit("tick")
function mat_make(width, height, peak, way)
{
var arr = []
var ret = []
for (var i = 0; i < height; i++)
ret[i] = []
// init
for (var i = 0; i < width * height; i++)
arr.push('A'.charCodeAt(0))
var myObject = {
a: 2,
b: 3
};
Object.defineProperty( myObject, Symbol.iterator, {
enumerable: false,
writable: false,
configurable: true,
value: function() {
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new MainView(this));
}
private class MainView extends View {
public class MainActivity extends Activity {
final static int USER_EVENT = 1000;
Handler handler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView tv1 = (TextView) findViewById(R.id.tv1);
final TextView tv2 = (TextView) findViewById(R.id.tv2);
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout rl = new RelativeLayout(this);
rl.setBackgroundColor(Color.BLUE);
public class MainActivity extends Activity {
private static final String TAG = "WDG";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_android_sample01);
Log.d(TAG, "onCreate");