Skip to content

Instantly share code, notes, and snippets.

View kewang's full-sized avatar
🎯
Focusing

Kewang kewang

🎯
Focusing
View GitHub Profile
@kewang
kewang / es.js
Last active April 30, 2024 13:42
const searchEsResult = await es.search({
index: 'helloworld',
body: {
from: 0,
size: 10,
min_score: 1.5, // 0~2
query: {
function_score: {
query: {
bool: {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kewang
kewang / index.js
Last active December 9, 2021 07:29
test2
var express = require('express');
var router = express.Router();
router.get("/test1/:address/:country", function (req, res, next) {
const name = req.query.name;
const number = req.query.number;
const address = req.params.address;
const country = req.params.country;
res.render("test1", {
@kewang
kewang / index.js
Created December 9, 2021 06:13
test1
router.get("/test1", function (req, res, next) {
res.render("test1", {
user: {
name: "kewang",
},
});
});
@kewang
kewang / 1.htm
Created November 11, 2020 17:27
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(function () {
$("input[name=drone]").on("change", function () {
Private Sub GridView_add_Load(sender As Object, e As EventArgs) Handles GridView_add.Load
For i = 0 To GridView_add.Rows.Count - 1
Dim animalAmount As TextBox = GridView_add.Rows(i).FindControl("TextBox_animalAmount")
Dim animalUnit As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_animalUnit")
Dim hidStoCoeff As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_stoCoeff") '腸胃甲烷係數
Dim hidStoCoeffN As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_stoCoeffN") '腸胃甲烷係數次方
Dim hidFecesCoeff As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_fecesCoeff") '糞尿甲烷係數
Dim hidFecesCoeffN As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_fecesCoeffN") '糞尿甲烷係數次方
Dim hidN2oCoeff As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_n2oCoeff") '糞尿氧化亞氮係數
Dim hidN2oCoeffN As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_n2oCoeffN") '糞尿氧化亞氮係數次方
@kewang
kewang / b.vb
Last active May 26, 2020 16:10
Function bin_emissions(ByVal gasID As Integer) As Data.DataTable
Dim liEmissions As List(Of Pollute.GHG.Info.Gas.Emissions) = sysLogic.GetEmissionsList(gasID)
Dim dt As New Data.DataTable
dt.Columns.Add("years")
dt.Columns.Add("cow")
dt.Columns.Add("otherCow")
dt.Columns.Add("buffalo")
dt.Columns.Add("goat")
dt.Columns.Add("pig")
dt.Columns.Add("whiteBroiler")
@kewang
kewang / a.vb
Last active May 26, 2020 05:52
dim yearfirst as integer = 10000
dim yearlast as integer = -1
'先把首年跟最後一年取出來
for each activity in liactivity
if activity.year > yearlast then
yearlast = activity.year
end
if activity.year < yearfirst then
@kewang
kewang / transform.js
Created April 11, 2020 14:05
Transform Xcode log to curl header and body
const buildHeaders = (str) => {
const headers = str
.split("\n")
.map((part) => {
const elem = part.split("=");
let key = elem[0].trim();
key = key.replace(/"/g, "");
package org.equit.jtf.base;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Toast;