Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
:)

Cosmin Popescu cosminpopescu14

:octocat:
:)
View GitHub Profile
View DateTimeAdapter.java
package com.mycompany.app;
import javax.xml.bind.ValidationEventHandler;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
View ArrayMap.java
package com.company;
import java.util.AbstractMap;
import java.util.Map;
import java.util.Set;
public class ArrayMap<K, V> extends AbstractMap<K,V> implements Map.Entry<K,V> {
@Override
public Set<Entry<K, V>> entrySet() {
return null;
@cosminpopescu14
cosminpopescu14 / CurlWrapper.cpp
Created Aug 17, 2020
Simple curl wrapper for C++
View CurlWrapper.cpp
#include "CurlWrapper.h"
#include <ostream>
CurlWrapper::CurlWrapper(CURLoption _options...)
{
this->req = curl_easy_init();
this->options = _options;
curl_easy_setopt(req, _options, "https://jsonplaceholder.typicode.com/todos");// just to test
}
View Javaಠ_ಠAnnotation.java
package com.company;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD) //can use in method only.
View JsonApiPlay.cpp
// JsonApi.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include "curl/curl.h"
#include "JsonApi.h"
#include "json.hpp"
using namespace std;
@cosminpopescu14
cosminpopescu14 / CompletedAndNotCompleted.kt
Created Jul 19, 2020
Agregate completed and not complted todos form an api
View CompletedAndNotCompleted.kt
import com.beust.klaxon.Json
import com.beust.klaxon.Klaxon
import java.net.HttpURLConnection
import java.net.URL
fun main() {
val url = URL("https://jsonplaceholder.typicode.com/todos")
var resultJson = ""
View CompletedAndNotCompleted.php
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
require "vendor/autoload.php";
$url = "http://jsonplaceholder.typicode.com/todos";
$client = new Client();
View JavaPlayTodosApi.java
package com.company;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
View MavenSupportConfigForJava.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>JsonApiPlay</artifactId>
<version>1.0-SNAPSHOT</version>
View JavaPlay.java
package com.company;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.util.Arrays;
You can’t perform that action at this time.