Skip to content

Instantly share code, notes, and snippets.

View phwt's full-sized avatar
💤

Phuwathid Summaviwat phwt

💤
  • Earth, Solar System
  • 09:10 (UTC +07:00)
View GitHub Profile
@phwt
phwt / sketch_multimeter.ino
Created April 30, 2018 09:54
Simple Arduino multimeter
#include <DHT.h>
#include <TM1637Display.h>
#define DHTPIN 9 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
int button = 13;
int status = false;
int chk;
int stt = false;
float hum; //Stores humidity value
@phwt
phwt / add_rule.bat
Last active May 1, 2018 09:09
Uplay Invisible Mode
@echo off
net session >nul 2>&1
if %errorLevel% == 0 (
echo Default uplay directory is "%ProgramFiles% (x86)\Ubisoft\Ubisoft Game Launcher\upc.exe".
) else (
echo Administrator Priviliages required to run this task.
pause
exit
)
@phwt
phwt / fcm_php_post.php
Last active June 18, 2018 07:44
Post notification from Firebase Cloud Messaging using cURL + PHP
<?php
$cp = curl_init();
curl_setopt($cp, CURLOPT_URL,"https://fcm.googleapis.com/fcm/send");
curl_setopt($cp, CURLOPT_POST, 1);
curl_setopt($cp, CURLOPT_HTTPHEADER, array(
'Authorization: key=[FIREBASE_SERVER_KEY]',
'Content-Type: application/json'
));
curl_setopt( $cp,CURLOPT_SSL_VERIFYPEER,false);
@phwt
phwt / curl_fcm_post
Last active June 18, 2018 07:45
Post notification from Firebase Cloud Messaging using only cURL
curl -X POST --header "Authorization: key=[FIREBASE_SERVER_KEY]" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"to\":\"[DEVICE_TOKEN]\",\"notification\":{\"body\":\"[MESSAGE]\"},\"priority\":10}"
@phwt
phwt / firebase_listview.java
Last active June 18, 2018 07:42
Populate Firebase Realtime Database to ListView
mListView = (ListView) findViewById(R.id.ListView);
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReferenceFromUrl("https://project-name.firebaseio.com/");
FirebaseListAdapter<String> firebaseListAdapter = new FirebaseListAdapter<String>(this,String.class,android.R.layout.simple_list_item_1,databaseReference) {
@Override
protected void populateView(View v, String model, int position) {
TextView textView = (TextView) v.findViewById(android.R.id.text1);
textView.setText(model);
}
};
mListView.setAdapter(firebaseListAdapter);
@phwt
phwt / add_rule.bat
Last active June 24, 2018 09:00
Uplay Offline Mode - View instruction here > https://github.com/phwt/uplay-offline-mode
@echo off
net session >nul 2>&1
if %errorLevel% == 0 (
echo Default uplay directory is "%ProgramFiles% (x86)\Ubisoft\Ubisoft Game Launcher\upc.exe".
) else (
echo Administrator Priviliages required to run this task.
pause
exit
)
@phwt
phwt / background.js
Created August 11, 2018 05:54
Chrome Extension - Multiple context menu item with separated action for each items.
chrome.contextMenus.create({
id: "context1",
title: "First",
contexts: ["all"]
});
chrome.contextMenus.create({
id: "context2",
title: "Second",
contexts: ["all"]
@phwt
phwt / terminals.json
Last active January 29, 2019 01:31
Build and Run current C file in gcc using "Terminals Manager" extension.
{
"autorun": false,
"terminals": [
{
"name": "Build and Run current file",
"description": "Build and Run current C file using GCC",
"focus": true,
"cwd": "[fileDirname]",
"commands": [
"gcc [fileBasename] -o [fileBasenameNoExtension]",

Computer Programming

ตัวแปร

type variable_name = value;

Type

ประเภทตัวแปร

  • char

Multimedia Technology

Selector

ใช้อ้างถึง Element ต่างๆในหน้า

  • *: เลือกทุกตัว
  • .class: Class
  • #id: ID
  • tag: Tag