What do you want to save?
Add Code snippet
New code examples
-
PHP 2021-09-19 10:55:02
php get location of user
//Gets the IP Address from the visitor $PublicIP = $_SERVER['REMOTE_ADDR']; //Uses ipinfo.io to get the location of the IP Address, you can use another site but it will probably have a different implementation $json = file_get_contents("http://ip... Add solution -
Javascript 2021-09-19 03:38:02
reduce javascript
const sum = array.reduce((accumulator, element) => { return accumulator + element; }, 0); // An example that will loop through an array adding // each element to an accumulator and returning it // The 0 at the end initializes accumulator to start at ... Add solution -
Other 2021-09-18 04:21:04
gdscript loop through array
# loop for n = 0 to 7 for n in 8: print(n) # Using range for n in range(8): print(n) # loop for n = 10 to 12 for n in range(10,13): print(n) # count down from 10 to 1 for n in range(10,0,-1): print(n) # loop for n = 2,4,6,8 in steps of... Add solution -
Shell/Bash 2021-09-18 00:08:02
awk '(split by space)
Just use function split in awk command to split a line into an array 'a' using a choosen string as delimiter as for example ", " in next use case: echo "hi, bye, hey" | awk '{split($0,a,", "); print a[3],a[2],a[1]}' Add solution -
PHP 2021-09-17 17:45:01
difference between guard and fillable laravel
Mass assignment is a process of sending an array of data that will be saved to the specified model at once. In general, you don’t need to save data on your model on one by one basis, but rather in a single process. In Laravel, fillable attributes ... Add solution -
C# 2021-09-17 16:11:01
c# open text file
// To save the text as one string use 'ReadAllText()' string text = System.IO.File.ReadAllText(@"C:\filepath\file.txt"); // To save each line seperately in an array use 'ReadAllLines()' string[] lines = System.IO.File.ReadAllLines(@"C:\file... Add solution -
TypeScript 2021-09-17 12:54:02
Write a C program to count total number of duplicate elements in an array.
/** * C program to count total number of duplicate elements in an array */ #include <stdio.h> #define MAX_SIZE 100 // Maximum array size int main() { int arr[MAX_SIZE]; int i, j, size, count = 0; /* Input size of array */ prin... Add solution -
Other 2021-09-17 12:26:03
collection.sort time complexity
t array. It is well-suited to merging two or more sorted arrays: simply concatenate the arrays and sort the resulting array. The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techiques from Peter McIlroy's "Op... Add solution -
Javascript 2021-09-17 09:44:02
10.3.1. Function Examples
/*Let's see function syntax in action. We first consider a program that prints an array of names.*/ let names = ["Lena", "James", "Julio"]; for (let i = 0; i < names.length; i++) { console.log(names[i]); } /*Followin... Add solution
Best helpers
Ranking is empty