Skip to content

Instantly share code, notes, and snippets.

View Canop's full-sized avatar
πŸ¦€
Available for missions (design, code, formation,etc.)

Denys SΓ©guret Canop

πŸ¦€
Available for missions (design, code, formation,etc.)
View GitHub Profile
I am the Miaou user with id 2 and name "Canop" on https://dystroy.org/miaou
function serie(start, max){
var arr = [];
for (var a = Math.ceil(456/100)*100; a ??? ; a ???) arr.push(a);
return arr;
}
console.log(serie(456, 2000));
@Canop
Canop / float.js
Last active May 16, 2018 16:05
float numbers formatting
const float = function(v, p=2){
let absv = Math.abs(v);
if (absv>10**(p+3) || absv<10**-p) return v.toExponential(p).replace(/0+e/, 'e');
return v.toFixed(p).replace(/\.0+$|0+$/, '');
}
// run the following to test the float function and
// compare the values with common formatting functions
const bodys = [
I am the Miaou user with id 4 and name "dystroy" on http://127.0.0.1:8204
dys@tour-noire:~/dev/broot> cargo install cargo-crev
Updating crates.io index
Downloaded cargo-crev v0.7.0
Downloaded 1 crates (18.5 KB) in 1.64s
Installing cargo-crev v0.7.0
Downloaded crev-common v0.7.0
Downloaded serde_yaml v0.8.9
Downloaded crev-data v0.7.0
Downloaded flate2 v1.0.8
Downloaded common_failures v0.1.1
#Β Code with semicolons:
use std::fmt;
use minimad::Text;
use crate::skin::MadSkin;
use crate::code;
use crate::line::FmtLine;
use crate::tbl;
dys@tour-noire:~/dev/termimad> cargo tree
termimad v0.6.1 (/home/dys/dev/termimad)
β”œβ”€β”€ crossbeam v0.7.2
β”‚ β”œβ”€β”€ cfg-if v0.1.9
β”‚ β”œβ”€β”€ crossbeam-channel v0.3.9
β”‚ β”‚ └── crossbeam-utils v0.6.6
β”‚ β”‚ β”œβ”€β”€ cfg-if v0.1.9 (*)
β”‚ β”‚ └── lazy_static v1.3.0
β”‚ β”œβ”€β”€ crossbeam-deque v0.7.1
β”‚ β”‚ β”œβ”€β”€ crossbeam-epoch v0.7.2
/// print the time that executing $timed took
/// but only when the log level is "debug".
/// The goal of this macro is to avoid doing useless
/// Instant::now in non Debug executions.
///
/// Examples:
/// ```
/// let sum = time!(
use {
crossterm::style::Colorize,
rand::Rng,
std::io::*,
};
fn int() -> i64 {
rand::thread_rng().gen_range(10, 50)
}
@Canop
Canop / broot-neovim-terminator_workflow.md
Created April 12, 2020 07:40
broot + neovim + terminator workflow

Introduction

I document here the new workflow I'm tuning in which I combine broot, neovim and terminator for enjoyable coding. I'll use here as support the exemple of Rust but it works about the same in other environnements.

Goals

  • keep open broot and neovim side to side and use broot as tree viewer and opener for vim
  • have a flexible setup: broot, neovim and terminator are basic tools that you should keep using as you do, this new combinations isn't a different world
  • Keep neovim uncluttered, don't prevent the shortcuts you already use for navigation and opening