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
def duplicate_count(text: str) -> int: | |
"""Write a function that will return the count of distinct case-insensitive | |
alphabetic characters and numeric digits that occur more than once in the | |
input string. | |
The input string can be assumed to contain only alphabets | |
(both uppercase and lowercase) and numeric digits. | |
"abcde" -> 0 # no characters repeat more than once | |
"aabbcde" -> 2 # 'a' and 'b' |
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
{ | |
"sidebarBg": "#15232d", | |
"sidebarText": "#dddddd", | |
"sidebarUnreadText": "#9effff", | |
"sidebarTextHoverBg": "#0d3a58", | |
"sidebarTextActiveBorder": "#15232d", | |
"sidebarTextActiveColor": "#ffffff", | |
"sidebarHeaderBg": "#15232d", | |
"sidebarHeaderTextColor": "#ffc600", | |
"onlineIndicator": "#60e019", |
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
function changes -d "Generate a Markdown changelog from conventional commits" -a target | |
# Use fallback variables if no arguments were given. | |
if test (count $argv) -eq 0 | |
set target master | |
end | |
# Include commit message, author name, and the short hash in parentheses. | |
set -l log_format "%s (_%aN_) (%h)" |
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
export type Difference = (a: number, b: number) => number | |
export default class Color { | |
protected red: number | |
protected green: number | |
protected blue: number | |
protected opacity?: number | |
static HEX_MIN = 0 | |
static HEX_MAX = 255 |
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
from pika import BlockingConnection | |
from pika.exceptions import AMQPConnectionError, AMQPChannelError | |
class MQ: | |
def __init__(self): | |
self.connection = BlockingConnection() | |
self.channel = self.connection.channel() |
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
#!/bin/bash | |
set -eu | |
# USAGE | |
# | |
# 1. Close Vivaldi | |
# 2. Run this script | |
# 3. Start Vivaldi again | |
# 4. Enjoy the fresh experience | |
# |
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
// Set test date to 12:00 on 18th June, 2018 | |
$testDate = Carbon::create(2018, 6, 18, 12); | |
Carbon::setTestNow($testDate); | |
// Execute the logic | |
BusinessClass::doStuff(); | |
// Check the results | |
$this->assertDatabaseHas('stuff', [ | |
// The data you need... |
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
/** | |
* Linked lists in Javascript | |
* @see https://dev.to/ryanfarney3/intro-to-linked-lists-in-js-19b4 | |
*/ | |
class Node { | |
constructor(data, next = null) { | |
this.data = data; | |
this.next = next; |
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
class Payment { | |
constructor(amount, currency) { | |
this.amount = amount; | |
this.currency = currency; | |
} | |
get localeMap() { | |
return { | |
USD: "en-US", |
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
function weather -d "Prints weather information for the given location" | |
if set -q $argv[1] | |
set location $argv[1] | |
else | |
set location "Jyväskylä" | |
end | |
# Parse language information from current locale | |
set -l language (string split "_" -- $LANG)[1] |