Skip to content

Instantly share code, notes, and snippets.

View Denys-Bushulyak's full-sized avatar
👋

Denys Bushulyak Denys-Bushulyak

👋
View GitHub Profile
@Denys-Bushulyak
Denys-Bushulyak / main.rs
Last active March 10, 2023 14:59
This gist show examples how to use webassembly memory
use std::ffi::CString;
use std::mem::forget;
use wasmtime::{Instance, Module, Store};
//
// Code of module which have to be compiled to wasm library
//
// use std::alloc::{alloc, Layout};
// use std::ffi::CString;
// use std::mem::forget;
@Denys-Bushulyak
Denys-Bushulyak / main.rs
Last active January 30, 2023 11:48
Example of the function add that accepts an asynchronous callback
use futures::future::BoxFuture;
#[tokio::main]
async fn main() {
let words = vec!["one", "two"];
let result = add(words, |word| {
Box::pin(async {
let mut kw = word;
kw.push("three");
kw
@Denys-Bushulyak
Denys-Bushulyak / main.rs
Last active February 24, 2024 12:02
Point to Structure in Rust in 2 versions
#[allow(dead_code)]
#[derive(Debug, Copy, Clone)]
struct A<'text> {
foo: &'text str,
baz: i32,
}
fn ptr_to_struct(p: *const A) {
let b: A = unsafe { *p }; // main part of this example!
println!("{:#?}", b);
@Denys-Bushulyak
Denys-Bushulyak / .vimspector.json
Created August 29, 2021 19:50
Vimspector Jest debug configuration for @nrwl nx
{
"configurations": {
"run": {
"adapter": "vscode-node",
"configuration": {
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
@Denys-Bushulyak
Denys-Bushulyak / machine.js
Last active December 10, 2020 19:38
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Denys-Bushulyak
Denys-Bushulyak / xdebug.ini
Created October 22, 2017 15:05
Configuration for debuging php from container
error_log = /dev/stdout
log_errors = On
display_errors = On
display_startup_errors = On
error_reporting = -1
xdebug.remote_enable = On
xdebug.remote_autostart = On
xdebug.remote_host = 192.168.137.111 #Your pc network address
xdebug.remote_port = 9001
@Denys-Bushulyak
Denys-Bushulyak / docker-compose.debug.yaml
Created October 22, 2017 15:03
Xdebug docker container (or service at swarm) configuration
version: "2"
services:
application:
image: php
environment:
— PHP_IDE_CONFIG=serverName=app.local #this is main part. And yes this is whitout quotation marks - it's requiring - wroted by blood :).
@Denys-Bushulyak
Denys-Bushulyak / docker-stack.yml
Last active December 19, 2017 12:39
Nginx proxy docker swarm example
version: "3.3"
volumes:
proxy:
networks:
proxy_network:
backend_network: #For connection another stacks to proxy. Should be created manualy.
external: true