Skip to content

Instantly share code, notes, and snippets.

View attdona's full-sized avatar

Attilio Donà attdona

View GitHub Profile
@attdona
attdona / references_by_reference.rs
Created May 8, 2018 20:26
simple examples of passing values by reference and references by reference
#[derive(Debug)]
struct Foo {
n: u32,
}
fn overwrite<T: Copy>(input: &mut T, new: &mut T) {
// FORBIDDEN: you will copy the pointer pointing to a future freed memory
// *input = *new;
}
let async = require('async')
function downloadSentinel(promObj) {
return new Promise((resolve, reject) => {
function makeRequest(url, i, callback) {
var sys = require('util'),
exec = require('child_process').exec,
child;
@attdona
attdona / map-demo.ts
Created January 31, 2018 09:33
typescript map example
class MyMap {
[key: string]: string;
}
let map: MyMap = new MyMap()
map["key"] = "value"
console.log(map["key"])
@attdona
attdona / sbapp.h
Created May 20, 2017 09:02
RIOT sbapp API example
/*
* Copyright (C) 2015 Attilio Dona'
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
* @author Attilio Dona'
*
*/