add 2
function add2(a) {
return a + 2
}
add(1)
All generations.
function add2(a) {
return a + 2
}
add(1)
function add_two(a) {
return a + 2;
}
add_two(1)
func getDate() -> String {
let date = Date()
let calendar = Calendar.current
let year = calendar.component(.year, from: date)
let month = calendar.component(.month, from: date)
let day = calendar.component(.day, from: date)
return "\(month)/\(day)/\(year)"
}
getDate()
int add(int a, int b) {
return a + b;
}
add(1, 2);
function addHeader(text) {
const header = document.createElement('h1');
header.style.color = 'lightpruple';
header.style.animation = 'spin 1s infinite linear';
header.innerHTML = text;
document.body.appendChild(header);
}
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
print(quicksort([3,6,8,10,1,2,1]))
for i in ~/Downloads/*.png; do mv $i ~/Desktop/; done
find ~/Downloads/ -size +10M -delete
def add(a, b):
return a + b
add(1, 2)
def quicksort(arr):
"""Returns the sorted array."""
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
mv ~/Downloads/*.jpg ~/Desktop/pictures
function add(a,b){
return a + b
}
add(1,2)
public static int add(int a, int b) {
return a + b;
}
add(1, 2);
async function main() {
const add = (a, b) => a + b
return add(1, 2)
}
main().then(console.log)
find ~/Downloads/ -size +10M -delete
fn add(a: i32, b: i32) -> i32 {
a + b
}
add(1, 2)
function add(a, b){
return a + b;
}
add(1, 2)
bash
for i in ~/Downloads/*.mp3; do
dur=$(ffmpeg -i "$i" 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,//)
hour=$(echo $dur | cut -d ':' -f 1)
min=$(echo $dur | cut -d ':' -f 2)
sec=$(echo $dur | cut -d ':' -f 3)
if ((min>0)) || ((hour>0)); then
cp "$i" ~/Music/
fi
done
find /home/abdelrahman/Downloads/ -name '*.mp3' -exec ffprobe -i {} -show_entries format=duration -v quiet -of csv="p=0" > /tmp/test.txt \; -exec bash -c 'if [ $(cat /tmp/test.txt) > 60 ]; then echo $(cat /tmp/test.txt) && mv {} /home/abdelrahman/Music/; fi' \;
def quicksort(arr):
"""
Sorts an array with quicksort algorithm.
"""
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
func add(a: Int, b: Int) -> Int {
return a + b
}
add(a: 1, b: 2)
bubblesort(lst):
for i in range(len(lst) - 1):
for j in range(len(lst) - i - 1):
if lst[j] > lst[j + 1]:
lst[j], lst[j + 1] = lst[j + 1], lst[j]
def main():
lst = [random.randint(0, 100
git revert HEAD
function add(a, b) {
return a + b
}
add(1,2)
** Blog post data here **
---
`
const createPost = ({ posts, postsDirectory }) => {
return new Promise((resolve, reject) => {
const slug = nanoid()
// create post
const post = {
id: slug,
content,
title,
date,
tags
}
// write post to posts directory
fs.writeFile(
path.join(postsDirectory, `${slug}.json`),
JSON.stringify(post, null, 2),
error => {
if (error) {
reject(error)
} else {
// add post to posts array
posts.push(post)
// write updated posts array to db.json
fs.writeFile(
path.join(dataDirectory, 'db.json'),
JSON.stringify({ posts }, null, 2),
error => {
if (error) {
reject(error)
} else {
resolve(post)
}
}
public void Main()
{
Console.WriteLine("Hello");
}
function add(a, b) {
return a + b
}
add(1, 2)
keeps the last object in the array `chunks`
### if you want to add a new article
- create a folder with the name of the article in the directory `techarticles`
- add an index.mdx with the content of the article
### if you want to add a new tutorial
- create a folder with the name of the tutorial in the directory `techtutorials`
- add an index.mdx with the content of the tutorial
## contact
You have a question, would like to comment on something or just want to say hi?
Visit [my twitter](https://twitter.com/paul_lilljedahl)
func add(a, b int) int {
return a + b
}
add(1, 2)
for file in ~/downloads; do
if [[ file -ge 10mb ]]; then
mv "$file" ~/desktop
rm "$file"
fi
done
mkdir test
mv * ~/Music/ -not -name '*michael*' -not -name '*jackson*'
function async_main() {
var args = process.argv.slice(2);
let [file_name, ...file_paths] = args;
fs.readFile(file_name, (err, data) => {
if (err) throw err;
let new_data = data.toString();
for (let fp of file_paths) {
console.log(new_data.replace("world", fp));
}
})
}
function addSpinningHeader(){
let header = document.createElement("h1")
header.innerText = "I'm a spinning header"
header.style.color = "purple"
header.style.animation = "spin infinite 2s linear"
document.body.append(header)
}
export async function main(event, context) {
// ...
}
function rand(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
rand([1,2,3,4,5])
def add(a:Int, b:Int):Int = {
a + b
}
add(1, 2)
function add(a, b) {
return a + b
}
add(1, 2)
import datetime
def get_date():
now = datetime.datetime.now()
return now.strftime("%Y-%m-%d")
get_date()
async function main() {
return "Hello World!"
}
^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$
function getRandomItem(arr) {
let length = arr.length;
const randomIndex = Math.floor(Math.random() * length);
return arr[randomIndex];
}
def add(a, b):
return a + b
function add($a, $b) {
return $a + $b;
}
add(1, 2);
function add(a, b){
return a + b
}
add(1, 2)
func randomObjs(objs []interface{}) []interface{} {
n := 5
if n > len(objs) {
n = len(objs)
}
newObjs := make([]interface{}, n)
for i := 0; i < n; i++ {
rand.Seed(time.Now().UnixNano())
newObjs[i] = objs[rand.Intn(len(objs))]
}
return newObjs
}
mv *.mp3 ~/Music/
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order.
int add(int a, int b){
return a+b;
}
int main(){
int a = 1;
int b = 2;
add(a, b);
}
Generate
More than just a code generator. A tool that helps you with a wide range of tasks. All in one place.
Function from Description
Text Description to SQL Command
Translate Languages
Generate HTML from Description
Code to Explanation
Fix invalid Code
Get Test for Code
Class from Description
Regex from Description
Regex to Explanation
Git Command from Description
Linux Command
Function from Docstring
Add typing to code
Get Language from Code
Time complexity
CSS from Description
Meta Tags from Description