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 <string> | |
#include <memory> | |
#include "libgointeropcode.h" | |
class Message { | |
public: | |
Message() {} | |
void setMsg(std::string msg) { |
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 | |
/* | |
#include <stdlib.h> | |
#include <stdbool.h> | |
typedef const char* (*get_message_body_callback)(long long); | |
static const char* getMessageBodyHelper(get_message_body_callback getMessgeBodyCb, | |
long long contextHandle) { | |
return getMessgeBodyCb(contextHandle); |
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 "C" | |
func calcFactorial(n uint64) (result uint64) { | |
if n > 0 { | |
result = n * calcFactorial(n-1) | |
return result | |
} | |
return 1 |
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 ballerina/io; | |
import ballerina/websocket; | |
map<int> userMap = {}; | |
map<websocket:Caller> connectionMap = {}; | |
isolated int lastUserId = 0; | |
service / on new websocket:Listener(9876) { | |
resource function get .() returns websocket:Service { | |
return new ChatService(); |
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 | |
// #cgo CFLAGS: -g -Wall | |
// #cgo CFLAGS: -I./calcClib | |
// #cgo LDFLAGS: -L./calcClib -lcalc_color_print | |
// #include <stdlib.h> | |
// #include "calcClib/calc_color_print.h" | |
import "C" | |
import ( |
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 <stdio.h> | |
#include <string.h> | |
#include "calc_color_print.h" | |
int factorial(int num) { | |
if(num > 1) { | |
return num * factorial(num - 1); | |
} | |
return 1; |
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
#ifndef _COLOR_PRINT_H | |
#define _COLOR_PRINT_H | |
int factorial(int number); | |
void color_print(const char* color, const char* message); | |
#endif |
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
from django.db import models | |
# Create your models here. | |
class Product(models.Model): | |
name = models.CharField(max_length=30) | |
product_category = models.CharField(max_length=30, blank=True, default='') | |
created_date = models.DateTimeField() | |
available_items = models.IntegerField(blank=True, null=True) |
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
from ariadne import ObjectType, QueryType, gql, make_executable_schema | |
from ariadne.asgi import GraphQL | |
# Define types using Schema Definition Language (https://graphql.org/learn/schema/) | |
# Wrapping string in gql function provides validation and better error traceback | |
type_defs = gql(""" | |
type Query { | |
hello: String! | |
} | |
""") |
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
class Book(models.Model): | |
title = models.CharField(max_length=50) | |
author = models.CharField(max_length=30) | |
description = models.TextField(blank=True) | |
publisher_book_url = models.URLField() | |
released_on = models.DateTimeField(auto_now_add=True) | |
posted_user = models.ForeignKey(get_user_model(), null=True, on_delete=models.CASCADE) |
NewerOlder