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
const url = "https://api.ixiaowai.cn/api/api.php?return=json" | |
const req = new Request(url) | |
function createPanel(img) { | |
let widget = new ListWidget() | |
widget.backgroundImage = img | |
return widget | |
} | |
async function loadImageUrl() { |
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
let items = await loadItems() | |
if (config.runsInWidget) { | |
let widget = await createWidget(items.slice(0, 4)) | |
Script.setWidget(widget) | |
} else if (config.runsWithSiri) { | |
let firstItems = items.slice(0, 5) | |
let table = createTable(firstItems) | |
await QuickLook.present(table) | |
} else { |
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
#include "unistd.h" | |
int code = fork(); | |
if (code >= 0) { | |
int flag = 1; | |
while (flag) { | |
sleep(1); | |
FILE *file; | |
try { |
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
public static int getViewWidth(View view) { | |
if (view.getWidth() > 0) { | |
return view.getWidth(); | |
} else if (view.getLayoutParams() != null && view.getLayoutParams().width > 0) { | |
return view.getLayoutParams().width; | |
} else { | |
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); | |
return view.getMeasuredWidth(); | |
} | |
} |
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
;Church 计数 | |
;所谓的数是指将 f 应用于 x 的次数。 | |
(def zero | |
(fn [f] | |
(fn [x] x))) | |
;增加一次 f 操作,即 add-1 | |
;(add-1 zero) => two | |
(defn add-1 [n] | |
(fn [f] (fn [x] |
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
companion object { | |
fun actionStart(context: Context, var1: String, var2: String) { | |
var intent = Intent(context, SecondActivity::class.java) | |
intent.putExtra("var1", var1) | |
intent.putExtra("var2", var2) | |
context.startActivity(intent) | |
} | |
} |
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
private void startToolbarAnim(boolean isUp) { | |
ObjectAnimator animator; | |
if (isUp) { | |
animator = ObjectAnimator.ofFloat(mToolbar, | |
"translationY", | |
mToolbar.getTranslationY(), | |
-mToolbar.getHeight()); | |
} else { | |
animator = ObjectAnimator.ofFloat(mToolbar, | |
"translationY", |