Skip to content

Instantly share code, notes, and snippets.

@bn3t
bn3t / example1.rs
Created February 17, 2018 10:08
Code from http://arthurtw.github.io/2014/11/30/rust-borrow-lifetimes.html in a version that works with modern Rust (2018).
#![allow(unused_variables, unused_assignments, unused_mut)]
use std::boxed::Box;
struct Foo {
f: Box<i32>,
}
// Owner cannot access resource during a mutable borrow - 1
fn main() {
@bn3t
bn3t / lib.rs
Created August 15, 2018 12:17
wasm_game_of_life optimisation
#![feature(use_extern_macros)]
extern crate wasm_bindgen;
use std::mem;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
#[macro_use]
extern crate lopdf;
use std::io::Result;
use lopdf::content::{Content, Operation};
use lopdf::{Document, Object, Stream};
pub fn do_it() -> Result<()> {
let mut doc = Document::with_version("1.5");
@bn3t
bn3t / resume.json
Last active January 9, 2021 15:04
resume.json
{
"basics": {
"name": "Bernard Niset",
"label": "Senior Frontend Developer (Freelance) at Kensu",
"summary": "Senior Software Engineer (Freelance) with a long experience in backend java based services and specialising now in Frontend development with modern JavaScript frameworks (ReactJS, Angular, VueJS). I want to provide the ideal solution that fits best the needs of my customers. \n\nI also have a strong interest in learning Rust (https://www.rust-lang.org/en-US/) (System tools, cli, webassembly).\n\n### Specialties\n\nReactJS/Redux, Javascript, ES6, Typescript, Modern JS (React, Angular, VueJS), Java, JEE, Spring, Hibernate, Web Services (SOAP, RESTFull apis, GraphQL, JAX-WS, JSON), Cloud Computing.",
"location": {
"city": "Brussels",
"countryCode": "BE"
},
"website": "https://www.smartobjects.be",
@bn3t
bn3t / index.html
Last active December 22, 2021 13:24
Use contextBridge to call a native-hello-world nodejs function (loadable in electron fiddle)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<link href="./styles.css" rel="stylesheet">
<title>Call native code via preload.js</title>
</head>
<body>
@bn3t
bn3t / index.html
Last active December 22, 2021 10:54
Show a call to the main process via ipc (loadable in electron fiddle)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>