This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "time" | |
import "math" | |
var exponentialBackoffCeilingSecs int64 = 14400 // 4 hours | |
func main() { | |
fmt.Println("Hello World") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ThemeType } from "./theme"; | |
import "styled-components"; | |
declare module "styled-components" { | |
export interface DefaultTheme extends ThemeType {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"regexp" | |
) | |
// Regex source: https://ihateregex.io/expr/url-slug/ | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"fmt" | |
"regexp" | |
"strconv" | |
) | |
func ipToInt(value string) (int, error) { | |
r := regexp.MustCompile(`[a-z]|:|\.`) // match chars from a to z, or : (colon), or . (dot) | |
v := r.ReplaceAll([]byte(value), []byte("")) // replace all chars matched previously |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/** | |
* Hypertext Transfer Protocol (HTTP) response status codes. | |
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes} | |
*/ | |
enum HttpStatusCode { | |
/** | |
* The server has received the request headers and the client should proceed to send the request body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
function insertionSort() { | |
var list = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0]; | |
for (var i = 0; i < list.length; i++) { | |
var key = list[i]; | |
var prevIndex = i - 1; | |
while (prevIndex >= 0 && list[prevIndex] > key) { | |
list[prevIndex + 1] = list[prevIndex]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<h1>Plot with x and y axes</h1> | |
<plot :height="200"/> | |
</div> | |
</template> | |
<script> | |
import plot from "@/components/plotWithXandYaxis.vue"; | |
export default { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as d3 from "d3"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
methods: { | |
render() { | |
this.setSizes(); | |
this.setScales(); | |
this.renderAxes(); | |
} | |
}, | |
mounted(){ | |
this.render(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* renderAxes: Based on the x and y scales it will | |
* render the axes in the svg. | |
*/ | |
renderAxes() { | |
const { x, y } = this.scales; | |
d3.select(".plot__axes__x").call(d3.axisBottom(x)); | |
d3.select(".plot__axes__y").call(d3.axisLeft(y)); | |
}, |
NewerOlder