This file contains hidden or 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
package main | |
import ( | |
"context" | |
"github.com/doorbash/my-api/routes" | |
"go.mongodb.org/mongo-driver/mongo" | |
"go.mongodb.org/mongo-driver/mongo/options" | |
"log" | |
"net/http" | |
"time" |
This file contains hidden or 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
package routes | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"github.com/doorbash/my-api/model" | |
"github.com/gorilla/mux" | |
"go.mongodb.org/mongo-driver/bson" | |
"go.mongodb.org/mongo-driver/bson/primitive" |
This file contains hidden or 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
package model | |
type User struct { | |
Id string `json:"id"` | |
Name string `json:"name"` | |
Coins int32 `json:"coins"` | |
Emojis []int32 `json:"emojis"` | |
CreatedAt int64 `json:"createdAt"` | |
} |
This file contains hidden or 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
import com.mongodb.MongoClient; | |
import com.mongodb.client.MongoCollection; | |
import com.mongodb.client.MongoCursor; | |
import com.mongodb.client.MongoDatabase; | |
import org.bson.Document; | |
import org.json.JSONArray; | |
import org.json.JSONObject; | |
import java.io.*; | |
import java.net.ServerSocket; |
This file contains hidden or 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
import io.undertow.Undertow; | |
import io.undertow.server.HttpHandler; | |
import io.undertow.server.HttpServerExchange; | |
public class HelloWorldServer { | |
public static void main(final String[] args) { | |
Undertow server = Undertow.builder() | |
.addHttpListener(8081, "localhost") | |
.setHandler(new HttpHandler() { |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func main() { | |
http.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) { |
This file contains hidden or 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 <iostream> | |
#include <thread> | |
#include <functional> | |
int main(int argc, char *argv[]) { | |
int x = 1; | |
std::cout << "[1] x is " << x << std::endl; |
This file contains hidden or 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
#define MESSAGE_TOTAL_LENGTH 301 | |
#define BIT_PERIOD 350 | |
#define DATA_PIN 4 | |
#include <SoftwareSerial.h> | |
const char *STR_REC_UNREAD = "\"REC UNREAD\""; | |
const char *STR_PHONE_NUMBER = "\"+98XXXXXXXXXX\""; | |
int data[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}; | |
int size = sizeof(data) / sizeof(int); |
This file contains hidden or 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
var SerialPort = require('serialport'); | |
var createInterface = require('readline').createInterface; | |
var moment = require('moment'); | |
const PHONE_NUMBER = "+989XXXXXXXXX"; | |
var port = new SerialPort('COM3'); | |
var lineReader = createInterface({ | |
input: port |
This file contains hidden or 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
#define MESSAGE_TOTAL_LENGTH 301 | |
#define BIT_PERIOD 350 | |
#define DATA_PIN 4 | |
#include <SoftwareSerial.h> | |
int data[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; | |
int size = sizeof(data) / sizeof(int); | |
SoftwareSerial mSerial(2, 3); // RX, TX |