Snippets Collections
function isArrayInArray(arr, item){
  var item_as_string = JSON.stringify(item);

  var contains = arr.some(function(ele){
    return JSON.stringify(ele) === item_as_string;
  });
  return contains;
}

var myArray = [
  [1, 0],
  [1, 1],
  [1, 3],
  [2, 4]
]
var item = [1, 0]

console.log(isArrayInArray(myArray, item));  // Print true if found
/* Create Buy Now Button dynamically after Add To Cart button*/
    function add_content_after_addtocart() {
    
        // get the current post/product ID
        $current_product_id = get_the_ID();
    
        // get the product based on the ID
        $product = wc_get_product( $current_product_id );
    
        // get the "Checkout Page" URL
        $checkout_url = WC()->cart->get_checkout_url();
    
        // run only on simple products
        if( $product->is_type( 'simple' ) ){
            echo '<a href="'.$checkout_url.'?add-to-cart='.$current_product_id.'" class="buy-now button" style="background-color: #000000 !important; margin-right: 10px;">קנה עכשיו</a>';
            //echo '<a href="'.$checkout_url.'" class="buy-now button">קנה עכשיו</a>';
        }
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );
<div
    class="justify-between py-6 md:flex"
    x-data="{
        open: false,
        hasScrolled: false,
        reactOnScroll() {
            if (this.$el.getBoundingClientRect().top < 120 && window.scrollY > 120) {
                this.hasScrolled = true;
            } else {
                this.hasScrolled = false;
            }
        } 
    }"
    x-init="reactOnScroll()"
    @scroll.window="reactOnScroll()"
>
const scale = (num, in_min, in_max, out_min, out_max) => {
  return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
<h2>Turbo Drive</h2>
<div>
  <a href="/greeting/?person=Josh">Click here to greet Josh (fast)</a>
</div>
<div>
    <a href="/greeting/?person=Josh&sleep=true">Click here to greet Josh (slow)</a>
</div>
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;




void decToBinary(int n)
{
    // array to store binary number 
    int binaryNum[3][3];
    
    //converting to binary 
    for (int i = 0; i < 3; i++) 
    {
        for (int j = 0; j < 3; j++)
        {
            binaryNum[i][j] = n % 2;
            n = n / 2;

        }
     }       

    // printing binary> array in reverse order 
    for (int i = 3-1; i >= 0; i--){
        for (int j = 3 - 1; j >= 0; j--)
        {
            if (binaryNum[i][j] == 0)
                cout << "H" << " ";
            else
                cout << "T" << " ";
        }
        cout << endl;
    }
    
 }

int main()
{
    int n;
    cout << "Enter a decimal number between 1 and 512 ";
    cin >> n;

    decToBinary(n);
    return 0;
}



// Android Studio 4.0
android {
    buildFeatures {
        viewBinding = true
    }
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


bool primeNumber(int n);
bool Emirp(int n);
int reversal(int n);
int recursive(int a, int b);

int main()
{
	
	int count = 0;
	int number = 13;
	while (count <= 100)
	{
		if (Emirp(number))
		{
			count++;
			if (count % 10 == 0)
				cout << setw(7) << number << endl;
			else
				cout << setw(7) << number;
		}
		number++;
	}
		

}
bool primeNumber(int n) {
	
		for (int i = 2; i <= n / 2; i++) {
			
			if (n % i == 0) {

				return false;
			}
		}
		return true;
}

bool Emirp(int n) {
	

	return primeNumber(n) && primeNumber(reversal(n));
	
}

int reversal(int n) {
	
		if (n < 10) {
			
				return n;
			
		}
		return recursive(n % 10, n / 10);
	
}

int recursive(int a, int b) {

	if (b < 1) {

		return a;

	}
	return recursive(a * 10 + b % 10, b / 10);
	
}



	
   




render() {
  return (
    <View style={styles.container}>
      <Image source={require('./assets/climbing_mountain.jpeg')} style={styles.imageContainer}>
      </Image>
      <View style={styles.overlay} />
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    width: null,
    height: null,
  },
  imageContainer: {
    flex: 1,
    width: null,
    height: null,
  },
  overlay: {
    ...StyleSheet.absoluteFillObject,
    backgroundColor: 'rgba(69,85,117,0.7)',
  }
})
function palindrome(str) {
    const alphanumericOnly = str
        // 1) Lowercase the input
        .toLowerCase()
        // 2) Strip out non-alphanumeric characters
        .match(/[a-z0-9]/g);
        
    // 3) return string === reversedString
    return alphanumericOnly.join('') ===
        alphanumericOnly.reverse().join('');
}



palindrome("eye");

static void Main(string[] args)
{
    using (WordprocessingDocument doc =
        WordprocessingDocument.Open(“Test.docx”, false))
    {
        foreach (var f in doc.MainDocumentPart.Fields())
            Console.WriteLine(“Id: {0} InstrText: {1}”, f.Id, f.InstrText);
    }
}
.wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 10px;
  grid-auto-rows: minmax(100px, auto);
}
.one {
  grid-column: 1 / 3;
  grid-row: 1;
}
.two { 
  grid-column: 2 / 4;
  grid-row: 1 / 3;
}
.three {
  grid-column: 1;
  grid-row: 2 / 5;
}
.four {
  grid-column: 3;
  grid-row: 3;
}
.five {
  grid-column: 2;
  grid-row: 4;
}
.six {
  grid-column: 3;
  grid-row: 4;
}
var express = require("express");
var app = express();
const session = require('express-session');
var MemcachedStore = require('connect-memjs')(session);

// configure sessions
var store = new MemcachedStore({servers: [process.env.MEMCACHEDCLOUD_SERVERS], username: process.env.MEMCACHEDCLOUD_USERNAME, password: process.env.MEMCACHEDCLOUD_PASSWORD});
app.use(session({ secret: 'keyboard cat',
   resave: true,
   saveUninitialized: true,
   cookie: { secure: true }, 
   store: store
}))
List<String> songList = new ArrayList<>();
songList.add("Some song"); //Repeat until satisfied

System.out.println("\n\tWelcome! Please choose a song!");
String songChoice = scan.nextLine();
while (!songList.contains(songChoice)) {
    //Do stuff when input is not a recognised song
}
The TypeConverter class is under namespace CsvHelper.TypeConversion

The TypeConverterAttribute is under namespace CsvHelper.Configuration.Attributes

    public class ToIntArrayConverter : TypeConverter
    {
        public override object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData)
        {
            string[] allElements = text.Split(',');
            int[] elementsAsInteger = allElements.Select(s => int.Parse(s)).ToArray();
            return new List<int>(elementsAsInteger);
        }

        public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
        {
            return string.Join(',', ((List<int>)value).ToArray());
        }
    }
To use this converter, simply add the following TypeConverterAttribute annotations on top of your properties:
To use this converter, simply add the following TypeConverterAttribute annotations on top of your properties:

    public class Names
    {
        [Name("name")]
        public string Name { get; set; }

        [Name("numbersA")]
        [TypeConverter(typeof(ToIntArrayConverter))]
        public List<int> NumbersA { get; set; }

        [Name("numbersB")]
        [TypeConverter(typeof(ToIntArrayConverter))]
        public List<int> NumbersB { get; set; }
    }
<style>

 .circle:before {
                    content: ' \25CF';
                    font-size: 50px;
                    color: black;
                }
</style>

<span class="circle"></span>
add_filter( 'woocommerce_available_payment_gateways', 'conditionally_disable_cod_payment_method', 10, 1);
function conditionally_disable_cod_payment_method( $gateways ){
    // HERE define your Products IDs
    $products_ids = array(2880);

    // Loop through cart items
    foreach ( WC()->cart->get_cart() as $cart_item ){
        // Compatibility with WC 3+
        $product_id = version_compare( WC_VERSION, '3.0', '<' ) ? $cart_item['data']->id : $cart_item['data']->get_id();
        if (in_array( $cart_item['product_id'], $products_ids ) ){
            unset($gateways['cod']);
            break; // As "COD" is removed we stop the loop
        }
    }
    return $gateways;
}
from datetime import datetime

datetime_object = datetime.strptime('Jun 1 2005  1:33PM', '%b %d %Y %I:%M%p')
const arrSum = arr => arr.reduce((a,b) => a + b, 0)
// arrSum([20, 10, 5, 10]) -> 45
import 'package:flutter/material.dart';

void main() {
  runApp(
    new MaterialApp(
      title: 'Hello World App',
      home: new myApp(),
    )
  );
}

class myApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Hello World App'),
      ),
      body: new Center(
        child: new Text(
          'Hello, world!'
        ),
      ),
    );
  }
}
double AttackerSuccessProbability(double q, int z)
{
    double p = 1.0 - q;
    double lambda = z * (q / p);
    double sum = 1.0;
    int i, k;
    for (k = 0; k <= z; k++)
    {
        double poisson = exp(-lambda);
        for (i = 1; i <= k; i++)
            poisson *= lambda / i;
        sum -= poisson * (1 - pow(q / p, z - k));
    }
    return sum;
}
<?php 
// PHP program to find nth 
// magic number 

// Function to find nth 
// magic number 
function nthMagicNo($n) 
{ 
	$pow = 1; 
	$answer = 0; 

	// Go through every bit of n 
	while ($n) 
	{ 
	$pow = $pow * 5; 

	// If last bit of n is set 
	if ($n & 1) 
		$answer += $pow; 

	// proceed to next bit 
	$n >>= 1; // or $n = $n/2 
	} 
	return $answer; 
} 

// Driver Code 
$n = 5; 
echo "nth magic number is ", 
	nthMagicNo($n), "\n"; 

// This code is contributed by Ajit. 
?> 
function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).text()).select();
  document.execCommand("copy");
  $temp.remove();

}
img {
  mask-image: url(‘mask.png’) linear-gradient(-45deg,
                        rgba(0,0,0,1) 20%, rgba(0,0,0,0) 50%);
  mask-image: url(#masking); /*referencing to the element generated and defined in SVG code*/
} 
router.post('/:id/edit', auth.requireLogin, (req, res, next) => {
  Post.findByIdAndUpdate(req.params.id, req.body, function(err, post) {
    if(err) { console.error(err) };

     res.redirect(`/`+req.params.id);
  });
});
[[NSProcessInfo processInfo] operatingSystemVersion]
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var slug = require('mongoose-slug-generator');

mongoose.plugin(slug);

const pageSchema = new Schema({
    title: { type: String , required: true},
    slug: { type: String, slug: "title" }
});

var Page = mongoose.model('Page', pageSchema);
module.exports = Page;
https://pastebin.com/0KT0sq1F
loadstring(game:HttpGet('https://raw.githubusercontent.com/EdgeIY/infiniteyield/master/source'))()
package com.lgcns.esg.repository.system.Custom;
import com.lgcns.esg.model.response.system.PageResult;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.PathBuilderFactory;
import com.querydsl.jpa.impl.JPAQuery;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import com.lgcns.esg.model.request.system.SearchSystemTypeRequest;
import com.lgcns.esg.model.response.system.SystemTypeResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.support.Querydsl;
import org.springframework.stereotype.Repository;

import java.util.List;


import static com.lgcns.esg.core.util.QueryBuilder.LIKE;
import static com.lgcns.esg.core.util.QueryBuilder.buildSearchPredicate;

@Repository
    @RequiredArgsConstructor
    public class SystemTypeRepositoryCustom {
        @PersistenceContext
        private final EntityManager entityManager;

        private static final QSystemType qSystemType = QSystemType.systemType;


        public PageResult<SystemTypeResponse> searchSystemType(SearchSystemTypeRequest request, Pageable pageable) {
            Querydsl querydsl = new Querydsl(entityManager, (new PathBuilderFactory().create(SystemTypeResponse.class)));
            JPAQuery<SystemTypeResponse> query = new JPAQuery<>(entityManager);
            BooleanBuilder conditions = new BooleanBuilder();
            query.select(Projections.bean(SystemTypeResponse.class, qSystemType.id, qSystemType.code, qSystemType.name)).from(qSystemType);
            conditions.and(qSystemType.isDeleted.eq(false));
            buildSearchPredicate(conditions, LIKE, qSystemType.code, request.getSystemTypeCode());
            buildSearchPredicate(conditions, LIKE, qSystemType.name, request.getSystemTypeName());
            query.where(conditions).orderBy(qSystemType.createAt.desc()).distinct();
            List<SystemTypeResponse> responses = querydsl.applyPagination(pageable, query).fetch();
            int count = (int)query.fetchCount();
            return new PageResult<>(count, responses);
        }
    }
}
new_stocks = {symbol: price * 1.02 for (symbol, price) in stocks.items()}

Code language: Python (python)
function my_scripts() {
     if(!is_admin() {
          wp_deregister_script('jquery');
          wp_enqueue_script('jquery', '//code.jquery.com/jquery-latest.min.js');
     }
}
add_action('wp_enqueue_scripts', 'my_scripts');


let now = new Date();
alert( now ); // показывает текущие дату и время
<h3>Email</h3>
<div class="py-1">
    <input class="p-1 br-1 email-input" type="email" placeholder="@email">
</div>
<h3>Password</h3>
<div class="py-1">
    <input class="p-1 br-1 password-input" type="password" placeholder="password">
</div>
<h3>Ranges</h3>
<div class="py-1">
    <input class="p-1 range-input" type="range">
</div>
<h3>Radio buttons</h3>
<div class="py-1">
    <input class="p-2 radio-btn" type="radio"><span class="px-1">Option one is this and that—be sure to include why it's great</span>
</div>
<h3>Checkboxes</h3>
<div class="py-1">
    <input class="p-2 radio-btn" type="checkbox"><span class="px-1">Default checkbox</span>
</div>
<div class="py-1">
    <input class="p-1 btn-primary" type="submit">
</div>
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    TextBox1.Text = "Bernard" + vbTab + "32"
    TextBox2.Text = "Luc" + vbTab + "47"
    TextBox3.Text = "François-Victor" + vbTab + "12"
End Sub
def generateParenthesis(n):
    #only add parentehsis if openN < n 
    #only add close parenthesis if closeN < openN 
    #valid if open == closed == n 

    stack = []
    res = []
    
    def backtrack(openN, closeN): 
        if openN == closeN == n: 
            res.append("".join(stack))
            return 
        if openN < n: 
            stack.append('(')
            backtrack(openN + 1, closeN)
            stack.pop()
        if closeN < openN: 
            stack.append(")")
            backtrack(openN, closeN + 1)
            stack.pop()
        #stack.pop() is necessary to clean up stack and come up with other solutions 
        
    backtrack(0, 0)
    #concept is you build openN, closeN but initially, they are at 0 
    return res 

generateParenthesis(3)
import streamlit as st #import streamlit right after installing it to the system

st.header('''Temperature Conversion App''') #Head / App title

#Converting temperature to Fahrenheit 
st.write('''Slide to convert Celcius to Fahrenheit''')
value = st.slider('Temperature in Celcius')
 
st.write(value, '°C is ', (value * 9/5) + 32, '°F')
st.write('Conversion formula: (°C x 9/5) + 32 = °F')
 
#Converting temperature to Celcius
st.write('''Slide to convert Fahrenheit to Celcius''')
value = st.slider('Temperature in Fahrenheit')
 
st.write(value, '°F is ', (value - 32) * 5/9, '°C')
st.write('Conversion formula: (°F - 32) x 5/9 = °C')
//Complete the method that takes a boolean value and return a "Yes" string for true, or a "No" string for false.

function boolToWord( bool ){
const str = bool === true ? "Yes" : "No"
return str
  }
.text-gradient {
    background: linear-gradient(94.23deg,#5374fa 12.41%,#fd9179 52.55%,#ff6969 89.95%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,min=0,sum=0,k=0;
	cin >> n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin >> a[i];	
	}
	    for(int i=0;i<n-1;i++)
		sum = sum + pow(abs(a[i] - a[i+1]),2);
		
		min = sum;
	
	    int b[n-1];
	
		for(int i=0;i<n-1;i++)
		{
			b[i] = (a[i] + a[i+1])/2;

		}
		int tt = 1;
	vector<vector<int> > d;
	int qwe=0;
	for(int i=0;i<n-1;i++)
	{
	    vector<int> v;
	for(int j=0;j<n;j++)
	{
	    	if((j == tt) && qwe ==0)
	    	{
			v.push_back(b[tt-1]);
			j--;
			qwe = 1;
	    	}
			else
	        v.push_back(a[j]);
	}
	tt++;
	qwe=0;
	d.push_back(v);
	}
	
			sum = 0;
			for(int i=0;i<n-1;i++)
			{
					for(int j=0;j<=n-1;j++)
					{
					    	sum = sum + pow(abs(d[i][j] - d[i][j+1]),2);
					}
					if(sum < min)
					min = sum;
					
					sum = 0;
			}
			
			cout << min;
	
}
/* ==========================================================================
Animation System by Neale Van Fleet from Rogue Amoeba
========================================================================== */
.animate {
  animation-duration: 0.75s;
  animation-delay: 0.5s;
  animation-name: animate-fade;
  animation-timing-function: cubic-bezier(.26, .53, .74, 1.48);
  animation-fill-mode: backwards;
}

/* Fade In */
.animate.fade {
  animation-name: animate-fade;
  animation-timing-function: ease;
}

@keyframes animate-fade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Pop In */
.animate.pop { animation-name: animate-pop; }

@keyframes animate-pop {
  0% {
    opacity: 0;
    transform: scale(0.5, 0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1, 1);
  }
}

/* Blur In */
.animate.blur {
  animation-name: animate-blur;
  animation-timing-function: ease;
}

@keyframes animate-blur {
  0% {
    opacity: 0;
    filter: blur(15px);
  }
  100% {
    opacity: 1;
    filter: blur(0px);
  }
}

/* Glow In */
.animate.glow {
  animation-name: animate-glow;
  animation-timing-function: ease;
}

@keyframes animate-glow {
  0% {
    opacity: 0;
    filter: brightness(3) saturate(3);
    transform: scale(0.8, 0.8);
  }
  100% {
    opacity: 1;
    filter: brightness(1) saturate(1);
    transform: scale(1, 1);
  }
}

/* Grow In */
.animate.grow { animation-name: animate-grow; }

@keyframes animate-grow {
  0% {
    opacity: 0;
    transform: scale(1, 0);
    visibility: hidden;
  }
  100% {
    opacity: 1;
    transform: scale(1, 1);
  }
}

/* Splat In */
.animate.splat { animation-name: animate-splat; }

@keyframes animate-splat {
  0% {
    opacity: 0;
    transform: scale(0, 0) rotate(20deg) translate(0, -30px);
    }
  70% {
    opacity: 1;
    transform: scale(1.1, 1.1) rotate(15deg);
  }
  85% {
    opacity: 1;
    transform: scale(1.1, 1.1) rotate(15deg) translate(0, -10px);
  }

  100% {
    opacity: 1;
    transform: scale(1, 1) rotate(0) translate(0, 0);
  }
}

/* Roll In */
.animate.roll { animation-name: animate-roll; }

@keyframes animate-roll {
  0% {
    opacity: 0;
    transform: scale(0, 0) rotate(360deg);
  }
  100% {
    opacity: 1;
    transform: scale(1, 1) rotate(0deg);
  }
}

/* Flip In */
.animate.flip {
  animation-name: animate-flip;
  transform-style: preserve-3d;
  perspective: 1000px;
}

@keyframes animate-flip {
  0% {
    opacity: 0;
    transform: rotateX(-120deg) scale(0.9, 0.9);
  }
  100% {
    opacity: 1;
    transform: rotateX(0deg) scale(1, 1);
  }
}

/* Spin In */
.animate.spin {
  animation-name: animate-spin;
  transform-style: preserve-3d;
  perspective: 1000px;
}

@keyframes animate-spin {
  0% {
    opacity: 0;
    transform: rotateY(-120deg) scale(0.9, .9);
  }
  100% {
    opacity: 1;
    transform: rotateY(0deg) scale(1, 1);
  }
}

/* Slide In */
.animate.slide { animation-name: animate-slide; }

@keyframes animate-slide {
  0% {
    opacity: 0;
    transform: translate(0, 20px);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0);
  }
}

/* Drop In */
.animate.drop { 
  animation-name: animate-drop; 
  animation-timing-function: cubic-bezier(.77, .14, .91, 1.25);
}

@keyframes animate-drop {
0% {
  opacity: 0;
  transform: translate(0,-300px) scale(0.9, 1.1);
}
95% {
  opacity: 1;
  transform: translate(0, 0) scale(0.9, 1.1);
}
96% {
  opacity: 1;
  transform: translate(10px, 0) scale(1.2, 0.9);
}
97% {
  opacity: 1;
  transform: translate(-10px, 0) scale(1.2, 0.9);
}
98% {
  opacity: 1;
  transform: translate(5px, 0) scale(1.1, 0.9);
}
99% {
  opacity: 1;
  transform: translate(-5px, 0) scale(1.1, 0.9);
}
100% {
  opacity: 1;
  transform: translate(0, 0) scale(1, 1);
  }
}

/* Animation Delays */
.delay-1 {
  animation-delay: 0.6s;
}
.delay-2 {
  animation-delay: 0.7s;
}
.delay-3 {
  animation-delay: 0.8s;
}
.delay-4 {
  animation-delay: 0.9s;
}
.delay-5 {
  animation-delay: 1s;
}
.delay-6 {
  animation-delay: 1.1s;
}
.delay-7 {
  animation-delay: 1.2s;
}
.delay-8 {
  animation-delay: 1.3s;
}
.delay-9 {
  animation-delay: 1.4s;
}
.delay-10 {
  animation-delay: 1.5s;
}
.delay-11 {
  animation-delay: 1.6s;
}
.delay-12 {
  animation-delay: 1.7s;
}
.delay-13 {
  animation-delay: 1.8s;
}
.delay-14 {
  animation-delay: 1.9s;
}
.delay-15 {
  animation-delay: 2s;
}

@media screen and (prefers-reduced-motion: reduce) {
  .animate {
    animation: none !important;
  }
}
import java.io.*;

class GFG {
    
    static void selectionSort(int arr[], int n){
        for(int i = 0; i < n; i++){
            int min_ind = i;
            
            for(int j = i + 1; j < n; j++){
                if(arr[j] < arr[min_ind]){
                    min_ind = j;
                }
            }
            
            int temp = arr[i];
            arr[i] = arr[min_ind];
            arr[min_ind] = temp;
        }
    }
    
	public static void main (String[] args) {
	    int a[] = {2, 1, 4, 3};
	    selectionSort(a, 4);
	    
	    for(int i = 0; i < 4; i++){
	        System.out.print(a[i] + " ");    // OUTPUT : 1 2 3 4
	    }
	}
}
// Optimised Bubble Sort

import java.io.*;

class GFG {
    
    static void bubbleSort(int arr[], int n){
        boolean swapped;
        
        for(int i = 0; i < n; i++){
            
            swapped = false;
            
            for(int j = 0; j < n - i - 1; j++){
                if( arr[j] > arr[j + 1]){
                    
                    // swapping
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                    
                    swapped = true;
                    
                }
            }
            if(swapped == false)
            break;
        }
    }
    
	public static void main (String[] args) {
	    int a[] = {2, 1, 4, 3};
	    bubbleSort(a, 4);
	    
	    for(int i = 0; i < 4; i++){
	        System.out.print(a[i] + " ");     // OUTPUT : 1 2 3 4
	    }
	}
}






// Bubble Sort

import java.io.*;

class GFG {
    
    static void bubbleSort(int arr[], int n){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n - i - 1; j++){
                if( arr[j] > arr[j + 1]){
                    
                    // swapping
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                    
                }
            }
        }
    }
    
	public static void main (String[] args) {
	    int a[] = {2, 1, 4, 3};
	    bubbleSort(a, 4);
	    
	    for(int i = 0; i < 4; i++){
	        System.out.print(a[i] + " ");     // OUTPUT : 1 2 3 4
	    }
	}
}
from pandas_profiling import ProfileReport
profile = ProfileReport(df, title="Pandas Profiling Report")
profile.to_file("your_report.html")
wsl --shutdown
diskpart
# open window Diskpart
select vdisk file="C:\WSL-Distros\…\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit
const useSortableData = (items, config = null) => {
  const [sortConfig, setSortConfig] = React.useState(config);
  
  const sortedItems = React.useMemo(() => {
    let sortableItems = [...items];
    if (sortConfig !== null) {
      sortableItems.sort((a, b) => {
        if (a[sortConfig.key] < b[sortConfig.key]) {
          return sortConfig.direction === 'ascending' ? -1 : 1;
        }
        if (a[sortConfig.key] > b[sortConfig.key]) {
          return sortConfig.direction === 'ascending' ? 1 : -1;
        }
        return 0;
      });
    }
    return sortableItems;
  }, [items, sortConfig]);

  const requestSort = key => {
    let direction = 'ascending';
    if (sortConfig && sortConfig.key === key && sortConfig.direction === 'ascending') {
      direction = 'descending';
    }
    setSortConfig({ key, direction });
  }

  return { items: sortedItems, requestSort };
}
star

Wed May 26 2021 16:34:09 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41661287/how-to-check-if-an-array-contains-another-array

@ejiwen #javascript

star

Tue May 18 2021 19:18:38 GMT+0000 (Coordinated Universal Time)

@Shesek

star

Thu Apr 08 2021 21:39:39 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/10359702/c-filehandling-difference-between-iosapp-and-iosate#:~:text=ios%3A%3Aapp%20%22set%20the,file%20when%20you%20open%20it.&text=The%20ios%3A%3Aate%20option,to%20the%20end%20of%20file.

@wowza12341 #c++

star

Tue Mar 09 2021 19:11:16 GMT+0000 (Coordinated Universal Time)

@klick #html #alpinejs

star

Mon Mar 01 2021 11:02:16 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/10756313/javascript-jquery-map-a-range-of-numbers-to-another-range-of-numbers

@arhan #javascript

star

Mon Jan 11 2021 03:36:21 GMT+0000 (Coordinated Universal Time)

@delitescere

star

Sat Jan 09 2021 02:24:44 GMT+0000 (Coordinated Universal Time) http://cpp.sh/

@mahmoud hussein #c++

star

Wed Dec 30 2020 07:30:31 GMT+0000 (Coordinated Universal Time)

@swalia ##kotlin,#java,#android

star

Tue Nov 10 2020 16:12:46 GMT+0000 (Coordinated Universal Time) http://cpp.sh/

@mahmoud hussein #c++

star

Sat Aug 08 2020 04:06:55 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41626402/react-native-backgroundcolor-overlay-over-image

@rdemo #javascript

star

Tue Aug 04 2020 19:25:25 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/freecodecamp-palindrome-checker-walkthrough/

@ludaley #javascript #strings #arrays

star

Sun Jun 21 2020 06:38:54 GMT+0000 (Coordinated Universal Time) http://www.ericwhite.com/blog/retrieving-fields-in-open-xml-wordprocessingml-documents/

@ourexpertize

star

Mon May 11 2020 21:33:40 GMT+0000 (Coordinated Universal Time) https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout

@Ulises Villa #css

star

Wed Apr 01 2020 11:31:57 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/60967832/insert-arraylist-into-while-condition

@SunLoves #java #java #arraylists #while-loops #equala

star

Wed Apr 01 2020 08:42:17 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/60966194/using-csvhelper-to-read-cell-content-into-list-or-array

@Anier #C#

star

Mon Mar 02 2020 22:07:43 GMT+0000 (Coordinated Universal Time)

@carlathemarla #css #shapes

star

Thu Feb 06 2020 12:35:11 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42108036/how-to-disable-cash-on-delivery-on-some-specific-products-in-woocommerce

@karanikolasms #php

star

Wed Jan 22 2020 18:52:28 GMT+0000 (Coordinated Universal Time) https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime

@logicloss01 #python #dates #functions #python3.8

star

Sun Jan 05 2020 19:37:35 GMT+0000 (Coordinated Universal Time) https://codeburst.io/javascript-arrays-finding-the-minimum-maximum-sum-average-values-f02f1b0ce332

@bezequi #javascript #webdev #arrays #math

star

Sun Dec 29 2019 19:42:22 GMT+0000 (Coordinated Universal Time) https://kodestat.gitbook.io/flutter/flutter-hello-world

@charter_carter #android #dart #flutter #ios #helloworld

star

Wed Dec 25 2019 13:48:42 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/find-nth-magic-number/

@marshmellow #php #interviewquestions #makethisbetter

star

https://codepen.io/shaikmaqsood/pen/XmydxJ

@mishka #javascript

star

https://www.creativebloq.com/features/css-tricks-to-revolutionise-your-layouts

@mishka #css

star

https://stackoverflow.com/questions/3339722/how-to-check-ios-version

@mishka #ios #swift

star

Mon Aug 26 2024 20:44:52 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/

@LizzyTheCatto

star

Sat Aug 10 2024 14:42:57 GMT+0000 (Coordinated Universal Time) https://helldivers-hub.com/

@Dhoover17

star

Mon Jul 29 2024 09:41:06 GMT+0000 (Coordinated Universal Time)

@namnt

star

Wed Feb 28 2024 07:51:24 GMT+0000 (Coordinated Universal Time) https://www.pythontutorial.net/python-basics/python-dictionary-comprehension/

@viperthapa #python

star

Thu Feb 15 2024 08:24:36 GMT+0000 (Coordinated Universal Time) https://lk.ko-rista.ru/

@Asjnsvaah

star

Sat Nov 25 2023 07:59:24 GMT+0000 (Coordinated Universal Time) https://www.thepixelpixie.com/how-to-properly-enqueue-jquery-in-a-wordpress-site/

@dmsearnbit #javascript

star

Fri Nov 24 2023 10:05:35 GMT+0000 (Coordinated Universal Time) https://learn.javascript.ru/date

@jimifi4494 #javascript

star

Thu Feb 16 2023 15:18:12 GMT+0000 (Coordinated Universal Time)

@logesh #html

star

Fri Nov 11 2022 18:41:00 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/366124/inserting-a-tab-character-into-text-using-c-sharp

@javicinhio #cs

star

Tue Sep 27 2022 02:03:10 GMT+0000 (Coordinated Universal Time) https://leetcode.com/problems/generate-parentheses/

@bryantirawan #python #neetcode #parenthesis #open #close

star

Mon May 30 2022 11:13:08 GMT+0000 (Coordinated Universal Time) https://try.freemarker.apache.org/

@mdfaizi

star

Tue Apr 12 2022 13:25:38 GMT+0000 (Coordinated Universal Time)

@Luduwanda #javascriptreact

star

Fri Apr 08 2022 16:10:51 GMT+0000 (Coordinated Universal Time)

@Mazen #css

star

Sun Mar 06 2022 22:14:59 GMT+0000 (Coordinated Universal Time) https://ayushshuklas.blogspot.com

@ayushshuklas

star

Thu Feb 17 2022 23:00:01 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/a-handy-little-system-for-animated-entrances-in-css/?utm_source

@MiaFolio #css

star

Tue Feb 08 2022 14:54:48 GMT+0000 (Coordinated Universal Time)

@Uttam #java #gfg #geeksforgeeks #lecture #sorting #selectionsort

star

Tue Feb 08 2022 14:45:51 GMT+0000 (Coordinated Universal Time)

@Uttam #java #gfg #geeksforgeeks #lecture #sorting #bubblesort

star

Wed Jan 26 2022 02:55:52 GMT+0000 (Coordinated Universal Time)

@jmbenedetto #python

star

Mon Dec 27 2021 12:25:33 GMT+0000 (Coordinated Universal Time) https://github.com/microsoft/WSL/issues/4699#issuecomment-627133168

@RokoMetek #bash #powershell

star

Fri Dec 24 2021 18:05:03 GMT+0000 (Coordinated Universal Time) https://www.smashingmagazine.com/2020/03/sortable-tables-react/

@dickosmad #react.js #sorting

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension