Skip to content

Instantly share code, notes, and snippets.

View d4nyll's full-sized avatar

Daniel Li d4nyll

View GitHub Profile
@d4nyll
d4nyll / startTrackTime.ts
Created January 11, 2024 19:56
console.log() with time offset
function startTrackTime() {
console.log(` s, ms, μs, ns`);
console.log(`000,000,000,000: start`);
const start = process.hrtime.bigint();
return function trackTime(message: string = '-') {
const end = process.hrtime.bigint();
console.log(
`${String(end - start)
.padStart(12, '0')
.replace(/(.{3})/g, '$1,')
@d4nyll
d4nyll / get-package-json.sh
Created February 13, 2018 19:34
Find all package.json file in current directory, excluding those from external packages
find -name "package.json" -not -path "*/node_modules/*"
@d4nyll
d4nyll / istanbul-reporters.md
Created July 16, 2017 21:57
Istanbul Reporters Examples

clover

The following is generated at coverage/clover.xml:

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1500242170615" clover="3.2.0">
  <project timestamp="1500242170615" name="All files">
    <metrics statements="161" coveredstatements="161" conditionals="24" coveredconditionals="18" methods="49" coveredmethods="49" elements="234" coveredelements="228" complexity="0" loc="161" ncloc="161" packages="9" files="15" classes="15">
      <package name="src">
@d4nyll
d4nyll / The Comprehensive Introduction to Docker
Created March 15, 2017 13:57
The Comprehensive Introduction to Docker
Docker is an open-source project that provides the tools and ecosystem to build and run applications inside containers.
In this article, we will first give you a conceptual overview of what a container is, and how it is different from a virtual machine (VM). Then we'll look into what a Docker container is specifically. Lastly, we will do a walk-through deploying a simple application using Docker.
The application we'll be deploying will be based on Meteor, which uses MongoDB as its database. We will deploy the application in one container, MongoDB on another container, and set it up so they can communicate with each other. Don't worry if you're not familiar with Meteor or MongoDB, we don't assume any prior knowledge. We also won't spend any time on explaining how they work - our focus will be solely on understanding Docker.
> After going through this tutorial, you'll be able to deploy your own app.
> Don't worry if some of the conceptual stuff sounds alien to you at first, that's normal - read through the

Keybase proof

I hereby claim:

  • I am d4nyll on github.
  • I am d4nyll (https://keybase.io/d4nyll) on keybase.
  • I have a public key whose fingerprint is 4C78 169D 776D 34DC A3DE 796B 003A F369 A717 B73C

To claim this, I am signing this object:

@d4nyll
d4nyll / _addseparator.scss
Created January 23, 2015 04:12
Add separator between elements
@mixin addSeparator($element, $separator, $padding) {
#{$element+'+'+$element}:before {
content: $separator;
padding: 0 $padding;
}
}