Skip to content

Instantly share code, notes, and snippets.

View letoan96's full-sized avatar

Le Tran The Toan letoan96

View GitHub Profile
@letoan96
letoan96 / custom_time.go
Created May 13, 2021 11:51 — forked from lummie/custom_time.go
Golang custom date / time formats when marshalling to JSON
// CustomTime provides an example of how to declare a new time Type with a custom formatter.
// Note that time.Time methods are not available, if needed you can add and cast like the String method does
// Otherwise, only use in the json struct at marshal/unmarshal time.
type CustomTime time.Time
const ctLayout = "2006-01-02 15:04:05 Z07:00"
// UnmarshalJSON Parses the json string in the custom format
func (ct *CustomTime) UnmarshalJSON(b []byte) (err error) {
(function() {
$(document).on('turbolinks:load', function() {
// Khi nhấn nút khoảng cách tới trạm 1
$('#getDistance_1').click(function() {
event.preventDefault();
console.log('get distance 1 clicked');
$('#getDistance_2').removeClass('active123');
$('#getDistance_1').addClass('active123');
return App.freechat.speak('getDistance_1'); //Hàm gửi tín hiệu đi
});
<h1 class="text-center">Adruino controller</h1>
<center>
<div>
<h3>Chế độ điều khiển</h3>
<a class="btn btn-primary" id="set_auto" href="">Auto</a> |
<a class="btn btn-primary" id="set_manual" href="">Manual</a>
</div>
*******************************
<div>
@letoan96
letoan96 / gist:f6395b8e1e4144774c26c946224e14fc
Last active April 5, 2018 07:55
change ip if you want to run on lan.
const cluster = require('cluster')
const dgram = require('dgram')
const express = require('express')
const crypt = require('crypto-js')
const parser = require('body-parser')
const request = require('request');
const fs = require('fs');
const transaction = {
"From": "Trung",
"To": "Hieu",