Skip to content

Instantly share code, notes, and snippets.

@avifatal
avifatal / app.controller.ts
Last active June 12, 2022 13:16
Dapr Nestjs integration
export interface PageViewDto{
pageUrl: string;
userAgent: string;
onTime: Date,
}
@Controller()
export class AppController {
constructor(private readonly daprClient: DaprClient) {}
@avifatal
avifatal / main.cs
Created May 6, 2020 15:38 — forked from gistlyn/main.cs
Simple OrmLite CRUD demo
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
public class User
{
public function getFollowers($accountId, $count = 20, $pageSize = 20, $delayed = true, $endCursor = '')
{
if ($delayed) {
set_time_limit($this->pagingTimeLimitSec);
}
$index = 0;
$accounts = [];
//$endCursor = '';
var log = new LoggerConfiguration()
.WriteTo.DatadogLogs(
apiKey: "55d6de65639ee32be4c7643afe7896fb",
//apiKey : "9534fa91b5761fc5478b849b0aa757e3",
source: "DEV",
service: "CLIENT",
host: "customer.com",
configuration: new DatadogConfiguration(url: "https://http-intake.logs.datadoghq.eu")
)
.CreateLogger();
@avifatal
avifatal / test.cs
Created March 6, 2020 19:04
Structure
SurveyTemplateEntity has:
MList<Lite<QuestionEntity>> Questions
SurveyEntity has:
Lite<SurveyTemplateEntity> SurveyTemplate
MList<AnswerEmbedded> Answers
Lite<FrontUserEntity> FrontUser
FrontUserEntity has:
MList<Lite<SurveyEntity>> Surveys;
@avifatal
avifatal / file.bash
Last active February 13, 2020 06:15
docker example
# copy the RAW(!) content of this file to a run.bash
# then in git bash run the following command:
# bash run.bash
# the content:
# crate root folder
mkdir test && cd test
mkdir framework
mkdir app
import * as Parse from 'parse/node'
Parse.Cloud.afterSave(Parse.User, (request : any) => {
request.log.info("Parse.Cloud.afterSave");
});
{
"compilerOptions": {
"allowSyntheticDefaultImports" : true,
"module": "commonjs",
"esModuleInterop": false,
"target": "es2016",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": false,
"outDir": "dist",
@avifatal
avifatal / Fetch.php
Created December 31, 2018 08:47
onlyDeepItems Fetch api
<?php
namespace Statamic\Addons\Fetch;
use Carbon\Carbon;
use Statamic\API\Str;
use Statamic\API\Page;
use Statamic\API\Asset;
use Statamic\API\Entry;
use Statamic\API\Search;
const shim = require('fabric-shim'); // CORE API
var Chaincode = class {
// Initialize the chaincode
async Init(stub) {
console.info('========= example02 Init =========');
try {
await stub.putState('The ID', Buffer.from({some : 'data'}));// you have to waite for every putState command to be finished
return shim.success();