View JSONUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.segmentfault.app.utils.json; | |
import com.alibaba.fastjson.JSON; | |
import com.alibaba.fastjson.TypeReference; | |
import com.alibaba.fastjson.annotation.JSONField; | |
import org.json.JSONObject; | |
import java.lang.reflect.Field; | |
import java.util.Iterator; |
View terminal_emulator_demo.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _XOPEN_SOURCE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <string.h> | |
#define BUFSIZE 1024 | |
int main() |
View function_in_js.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = function() { | |
}; | |
var e = []; | |
e[0] = a; | |
e[1] = function() { | |
}; | |
console.log(a == e[1]); |
View ScalableImageView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.graphics.Matrix; | |
import android.graphics.RectF; | |
import android.graphics.drawable.Drawable; | |
import android.support.v4.view.MotionEventCompat; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import android.widget.ImageView; | |
/** |
View simple-template-engine.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
var fd = fs.openSync("template.html","r"); | |
fs.readFile("template.html", {encoding:"utf-8"},function(err,data){ | |
if(err) { | |
console.err("error in open file with:" + err); | |
return; | |
} | |
data = data.replace(/\n/g, '\\n') | |
.replace(/<%=([\s\S]+?)%>/,function(match,code){ | |
return "' + " + code + " + '"; |
View NestedScrollSwipeRefreshLayout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.segmentfault.app.view; | |
import android.content.Context; | |
import android.support.v4.view.MotionEventCompat; | |
import android.support.v4.view.NestedScrollingChild; | |
import android.support.v4.view.NestedScrollingChildHelper; | |
import android.support.v4.view.ViewCompat; | |
import android.support.v4.widget.SwipeRefreshLayout; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; |
View Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gemini.demo; | |
public class Main { | |
public static void main(String[] args) { | |
// write your code here | |
TreeNode root = new TreeNode(); | |
root.setColor(TreeNode.COLOR_BLACK); | |
root.setData(50); |