Skip to content

Instantly share code, notes, and snippets.

View jedsada-gh's full-sized avatar
😄
undefined

Jedsada Tiwongvorakul jedsada-gh

😄
undefined
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract ElectionVote {
address public owner;
mapping(address => bool) adminLookup;
Candidate[] candidateLookup;
mapping(address => bytes32) vouter;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract TodoList {
struct Task {
bytes32 id;
string title;
string description;
cd /Library/Preferences
sudo rm com.sophos.sav.plist

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer —force_remove
import axios from "axios";
(async () => {
const req = axios.create({ baseURL: "https://jsonplaceholder.typicode.com" });
const json = (await req.get("/todos")).data
const newItems = []
for(let i = 0; i < json.length; i++) {
if (json[i].completed === false) {
newItems.push(json[i])
}
const sortMin2Max = (items: number[]): number[] => {
let temp = 0;
for (let i = 0; i < items.length; i++) {
for (let j = 0; j < items.length; j++) {
if (items[j] > items[j + 1]) {
temp = items[j];
items[j] = items[j + 1];
items[j + 1] = temp;
}
@jedsada-gh
jedsada-gh / ModSalary.sol
Created April 13, 2021 11:02 — forked from korrio/ModSalary.sol
ModSalary.sol
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
/******************************\
!!! คำเตือน โปรดระวัง !!!
การใช้บอท มีความเสี่ยงที่จะถูกแบนได้
แนะนำให้สร้างบัญชีใหม่มาบอทโดยเฉพาะ
\******************************/
class TLMBot {
constructor(minWaitTime = 5000, maxWaitTime = 15000) {
this.minWaitTime = minWaitTime;
this.maxWaitTime = maxWaitTime;
@jedsada-gh
jedsada-gh / how-to-use-webview
Created January 17, 2021 06:16
how-to-use-webview
startActivity(Intent(this, WebViewActivity::class.java).apply{
putExtra(KEY_TITLE, getString("Title"))
putExtra(KEY_URL_WEBVIEW, URL)
})
// AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
@jedsada-gh
jedsada-gh / activity_webview.xml
Last active January 17, 2021 06:00
webview-layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
@jedsada-gh
jedsada-gh / WebviewActivity.kt
Created January 17, 2021 05:58
webview-activity
typealias WebViewClientUrlCallback = (url: String?) -> Unit
typealias WebChromeClientLoading = (progress: Int) -> Unit
class WebViewActivity : AppCompatActivity() {
private val mWebViewClient: WebViewClient by lazy { WebViewClient() }
private val mWebViewChromeClient: WebChromeClient by lazy { WebChromeClient() }
@SuppressLint("SetJavaScriptEnabled")
override fun onCreate(savedInstanceState: Bundle?) {