All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Count Characters in a String in Go

In Golang, there are 2 ways to count characters in a string. Using RuneCountInString Function Straight forward natively use the utf8.RuneCountInString() The following example should cover whatever you are trying to do: package main import ( ...
aweis

How to Determine if an Object is Iterable in Python

In Python, there are 2 ways to determine if an object is iterable. Using Duck Typing Duck typing is a concept related to dynamic typing, where the type or the class of an object is less important than the methods it defines. When you use duck typing...
Unused

How to Remove Duplicates in List in Python

In Python, there are 3 ways to remove duplicates in list. Using Built-in set Function The built-in set() function returns a new set object, optionally with elements taken from iterable. If you later need a real list again, you can similarly pass the...
pooriabt

How to Check If an Object Is of a Given Type in Python

In Python, there are 2 ways to check if an object is of a given type. Using isinstance Method The isinstance(object, classinfo) method returns True if the object argument is an instance of the classinfo argument, or of a (direct, indirect, or virtua...
Unused

How to Get the Class Name of an Instance in Python

In Python, there are 3 ways to get the class name of an instance. Using type Method The type(object) method returns the type of an object. For example, #!/usr/bin/python3 class A: pass a = A() name = type(a).__name__ print(name) A ...
Sambhav Khandelwal

How to split a string into a slice in Go

Splitting a String into a Slice in Golang.Using strings.Split Function Use the strings.Split function to split a string into its comma separated values. package main import ( "fmt" "strings" ) func main() { s := "Japan,Germany" // func S...
Unused

How to format a string in Python

Python String Formatting Best Practices.Fancier Output Formatting To use formatted string literals, begin a string with f or F before the opening quotation mark or triple quotation mark. Inside this string, you can write a Python expression between {...
Sambhav Khandelwal

Built-in Types in Python

Python’s Core Data Types.Core Data Types The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Built-in objects preview: Object type: Numbersint, float, complex.Strings'spam', "Bob's", b'a\x01c', u'sp\xc4m...
Unused

How to check if a string contains a substring in JavaScript

How do you check if a string contains a substring?.Using String.prototype.includes The includes() method performs a case-sensitive search to determine whether one string may be found within another string, returning true or false as appropriate. 'Go...
pooriabt

How to check if string contains a substring in Go

Go test string contains substring.Using strings.Contains Function How do I check if a string is a substring of another string in Go? Use the function Contains from the strings package. Contains function returns a boolean value. It returns true if the...
Tomoki

How to use the curl command in Linux

command line tool and library for transferring data with URLs. cURL (pronounced 'curl') is a computer software project providing a library (libcurl) and command-line tool (curl) for transferring data using various network protocols. The name ...

How to use the Docker-compose up command line

Create and start containers.Builds, (re)creates, starts, and attaches to containers for a service. If you want to force Compose to stop and recreate all containers, use the --force-recreate flag. Recreate containers docker-compose up -...

How to use the Docker-compose exec command line

Execute a command in a running container.With this subcommand you can run arbitrary commands in your services. Commands are by default allocating a TTY, so you can use a command such as docker-compose exec web sh to get an interactive prompt. ...

How to install amCharts

amCharts is a maker for widely used JavaScript-based interactive charts and maps programming libraries and tools.--pname-- was written in TypeScript, it can be used in any JavaScript-compatible environment - TypeScript applications, React or Angular2...

How to install date-fns

Modern JavaScript date utility library.--pname-- provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js. --pname-- is like lodash for dates. It has 140+ functions for all occasions...