Snippets Collections
import moment from 'moment';

const expiryDate = '03-21-2023';
const currentDate = moment();

// Parse the expiry date using Moment.js
const parsedExpiryDate = moment(expiryDate, 'MM-DD-YYYY');

// Compare the expiry date to the current date to check if the token is expired
if (parsedExpiryDate.isBefore(currentDate)) {
  console.log('Token has expired!');
} else {
  console.log('Token is still valid');
}
function past(h, m, s){
  return s*1000 + m*60000 + h*3600000
}
function paperwork(n, m) {
  if (n < 0  || m < 0) {
return 0
  } else {
    return n * m 
  }
}
import React from "react"
import ContentLoader from "react-content-loader"

const MyLoader = (props) => (
  <ContentLoader 
    speed={2}
    width={210}
    height={260}
    viewBox="0 0 210 260"
    backgroundColor="#f3f3f3"
    foregroundColor="#ecebeb"
    {...props}
  >
    <circle cx="162" cy="112" r="49" />
  </ContentLoader>
)

export default MyLoader

int motor1pin1 = 2;
int motor1pin2 = 3;

int motor2pin1 = 4;
int motor2pin2 = 5;


void setup() {
  // put your setup code here, to run once:
  pinMode(motor1pin1,OUTPUT);
  pinMode(motor1pin2,OUTPUT);
  pinMode(motor2pin1,OUTPUT);
  pinMode(motor2pin2,OUTPUT);
}


void forward() {
  digitalWrite(motor1pin1,HIGH);
  digitalWrite(motor1pin2,LOW);

  digitalWrite(motor2pin1,LOW);
  digitalWrite(motor2pin2,HIGH); 
  delay(1000); 
}

void pause() {
  digitalWrite(motor1pin1,LOW);
  digitalWrite(motor1pin2,LOW);

  digitalWrite(motor2pin1,LOW);
  digitalWrite(motor2pin2,LOW); 
  delay(1000); 
}


void loop() {
  // put your main code here, to run repeatedly:
  forward();
  pause();
  
}
int motor1pin1 = 2;
int motor1pin2 = 3;

int motor2pin1 = 4;
int motor2pin2 = 5;


void setup() {
  // put your setup code here, to run once:
  pinMode(motor1pin1,OUTPUT);
  pinMode(motor1pin2,OUTPUT);
  pinMode(motor2pin1,OUTPUT);
  pinMode(motor2pin2,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(motor1pin1,LOW);
  digitalWrite(motor2pin1,HIGH);

  digitalWrite(motor1pin2,LOW);
  digitalWrite(motor2pin2,HIGH);  
 
}
int motor1pin1 = 2;
int motor1pin2 = 3;

int motor2pin1 = 4;
int motor2pin2 = 5;


void setup() {
  // put your setup code here, to run once:
  pinMode(motor1pin1,OUTPUT);
  pinMode(motor1pin2,OUTPUT);
  pinMode(motor2pin1,OUTPUT);
  pinMode(motor2pin2,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(motor1pin1,HIGH);
  digitalWrite(motor1pin2,LOW);

  digitalWrite(motor2pin1,HIGH);
  digitalWrite(motor2pin2,LOW);  
 
}
#include <iostream>
using namespace std;

template <class T>
class Arithmetic
{
private :
    T a;
    T b;
public :
    Arithmetic(T a,T b);
    T add();
    T sub();
};

template<class T>
Arithmetic<T>::Arithmetic(T a,T b)
{
    this->a =a;
    this->b =b;
}

template <class T>
T Arithmetic<T>:: add()
{
    T c;
    c = a+b;
    return c;
}

template <class T>
T Arithmetic<T>:: sub()
{
    T c;
    c = a-b;
    return c;
}

int main() 
{
    Arithmetic<int> ar(10,5);
    cout<<ar.add()<<endl;
    cout<<ar.sub()<<endl;
    
    Arithmetic<float> ar1(1.22,1.3);
    cout<<ar1.add()<<endl;
    cout<<ar1.sub()<<endl;
    
    return 0;
}
  static userTimezoneToSpecifiedTimeZone(date: Date, time: string, timeZone: string): Date {
    // Major timeZone's for Australia and their offset values in hours
    // NOTE Darwin etc -> I'm not sure 9.5 or 10.5 will work
    const DST_OFFSETS = {
      'Australia/Sydney': [11, 10],
      'Australia/Brisbane': [11, 10],
      'Australia/Melbourne': [11, 10],
      'Australia/Canberra': [11, 10],
      'Australia/Darwin': [10.5, 9.5],
      'Australia/Adelaide': [10.5, 9.5],
      'Australia/BrokenHill': [10.5, 9.5],
      'Australia/Perth': [9, 8]
    };

    // Calculate the offset depending on if the date is in is DST or not
    const [dstStartOffset, dstEndOffset] = DST_OFFSETS[timeZone];
    const daylightSavingOffset = this.isDaylightSavingTime(date, timeZone) ? dstStartOffset : dstEndOffset;

    const hoursAndMinutes = time.split(':');

    // Collect raw values to create date object
    let year = date.getFullYear();
    let month = date.getMonth();
    let day = date.getDate();
    let hours = Number(hoursAndMinutes[0]);
    const minutes = Number(hoursAndMinutes[1]);

    // We then convert these values to the timezone's UTC by adding the offset
    // i.e. Sydney is 10/11 hours ahead of GMT, so we need to minus 10/11 hours to get GMT.
    // allow for the GMT being the day, month and year before when subtracting the offset.
    if ((hours - daylightSavingOffset) < 0) {
      hours = 24 + (hours - daylightSavingOffset);
      day--;
      if ((month - 1) < 0) {
        year  = year--;
        month = 11;
      }
    } else {
      hours = hours - daylightSavingOffset;
    }
    
    // Create the date object using the UTC value we created above.
    const returnDate = new Date(Date.UTC(year, month, day, hours, minutes, 0));

    // console.log(`${timeZone} Timezone from FormHelper-> ` + returnDate.toLocaleString(undefined, {timeZone: timeZone}))

    return returnDate;
    
   }

   static isDaylightSavingTime(date: Date, timeZone: string): boolean {
    // Get the time zone offset for the specified date
    const offset = new Date(date.toLocaleString('en-US', { timeZone })).getTimezoneOffset();
  
    // Calculate the daylight saving time start and end dates for the current year
    const year = date.getFullYear();
    const dstStart = new Date(Date.UTC(year, 9, 1, 16)).toLocaleString('en-US', { timeZone });
    const dstEnd = new Date(Date.UTC(year, 3, 1, 16)).toLocaleString('en-US', { timeZone });
  
    // Determine if the specified date falls within the daylight saving time period
    return offset < new Date(dstEnd).getTimezoneOffset() && offset >= new Date(dstStart).getTimezoneOffset();
  }
  
using System;
class Demo {
   public static void Main(){
      Double val1 = 30.40;
      Double val2 = Double.MinValue;
      Double val3 = Double.MaxValue;
      Console.WriteLine("Absolute value of {0} : {1}", val1, Math.Abs(val1));
      Console.WriteLine("Absolute value of {0} : {1}", val2, Math.Abs(val2));
      Console.WriteLine("Absolute value of {0} : {1}", val3, Math.Abs(val3));
   }
}
SELECT Id, Name, CreatedById, CreatedDate, CEC_Created_By__c, LastModifiedDate, LastModifiedById, cg__Case__c, cg__Content_Type__c, cg__Description__c, cg__File_Name__c, cg__File_Size__c, cg__File_Size_in_Bytes__c, CEC_SendNotification__c, cg__Sync_Id__c, cg__Private__c, cg__WIP__c, cg__Version_Id__c, CEC_Upload_Complete_Timestamp__c, CEC_Event_Notification_Record__c FROM cg__CaseFile__c ORDER BY SystemModStamp DESC LIMIT 10
flutter build apk - obfuscate - split-debug-info=/<project-name>/<directory>
const store=()=>{
    console.log("below we can describe a nested function")
    
    let s1=()=>{
        console.log("s1 is inside function ,and we can call this function inside this functon");
    }
    s1();
}


store();
package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class OracleConnection{

    public static Connection getConnection()
    {
         Connection myConnection = null;
         String userName, password, service, url;

         userName = "vehiculefleetdb" ;
         password = "123" ;
         service = "localhost" ;

         url = "jdbc:oracle:thin:";

        try {

                myConnection = DriverManager.getConnection(url + userName + "/" + password + "@" + service);
                 System.out.println(" Connection successfull");

        } catch (SQLException ex) {
              ex.printStackTrace();
                  System.out.println(" Connection failed  ");
        }

        return myConnection;
    }


}
package bus ;

import java.io.Serializable;

public class Vehicule implements IMileageEfficiency, Serializable{


	private static final long serialVersionUID = 1L;
	double ME;
	double serialNumber;
	String made;
	String model;
	String color;
	int lenghtInFeet;
	protected int tripCounter;
	double energyConsumed;
	String eSuffix;

	Vehicule(double serialNumber, String made, String model, String color,
			 int lenghtInFeet, int tripCounter, String eSuffix){
		ME = 0;
		this.tripCounter = tripCounter;
		energyConsumed = 0;
		this.serialNumber = serialNumber;
		this.made = made;
		this.model = model;
		this.color = color;
		this.lenghtInFeet = lenghtInFeet;
		this.eSuffix = eSuffix;
		
	};
	
	public double getSN() {
		return this.serialNumber;
	}
	
	public double getMilePerUnitOfEnergy() {
		if (energyConsumed == 0) {
			return 0;
		}else {
		ME = this.tripCounter/this.energyConsumed;
		return ME;
		}
	}
	
	public void makeTrip(int tripCounter, double energyConsumed) {
		this.energyConsumed = energyConsumed;
		this.tripCounter = tripCounter;
		
	}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RPG_Game.Classes
{
    public static class GameManager
    {
        public static List<Player> ListPlayers = new List<Player>();
        public static Player CurrentPlayer;
        public static bool gameOver = false;
        private static int BattleRounds = 0;
        private static int MaxRounds = 5;
        
        public static void StartGame(string name)
        {
            try
            {
                GameManager.ListPlayers = DataXML.Load("HighScores.xml");
            }catch(Exception e) {
                Console.WriteLine("Exception error : "+e.Message);
            }
            
            Player player = Search_Player(name);
            //Player is loaded from the file 
            if(player != null)
            {
                if (player.IsDead())
                {
                    CurrentPlayer = new Player(name, 100);
                }
                else
                {
                    CurrentPlayer = player;
                }
            }
            else   //Player is not found
            {
                CurrentPlayer = new Player(name, 100);
            }            
        }
        //-------------------------------------------------------------------------------
        public static Player Search_Player(string name)
        {
            foreach (Player player in ListPlayers)
            {
                if (String.Compare(player.Name, name, true) == 0)
                {
                    return player;
                }
            }
            return null;
        }
        //-----------------------------------------------------------------------------
        public static void GameOver()
        {
            gameOver = true;
            Console.WriteLine("Game Over !");
        }
        public static void SaveGame()
        {
            CurrentPlayer.Enemy = null;
            Player player = Search_Player(CurrentPlayer.Name);
            //Player is found
            if (player != null)
            {
                if (player.GP < CurrentPlayer.GP)
                {
                    ListPlayers.Remove(player);// remove the existing player with lower score
                    ListPlayers.Add(CurrentPlayer);//save the player of highest score in List
                }
            }
            else   //Player is not found
            {
                ListPlayers.Add(CurrentPlayer);//save the player in List
            }
            //Save the List in XML file
            DataXML.Save("HighScores.xml", GameManager.ListPlayers);
        }
        //--------------------------------------------------------------------------------------------
        public static void StartBattle()
        {
            Console.WriteLine("You are triying to kill the enemy " + GameManager.CurrentPlayer.Enemy.Name);
            GameManager.CurrentPlayer.Attack();
            BattleRounds++;

            System.Threading.Thread.Sleep(1000);//wait for one second

            if (GameManager.CurrentPlayer.Enemy != null &&
                GameManager.CurrentPlayer.Enemy.IsDead())
            {
                Message.Danger("\nYour enemy is dead !");
                BattleRounds = 0;
                GameManager.CurrentPlayer.Enemy = null;
                GameManager.Explore();
            }
            else
            {
                Message.Danger("\nYour enemy is not dead !");

                if (BattleRounds >= MaxRounds)
                {
                    Message.Danger("\nYou panic and run away ....");
                    GameManager.CurrentPlayer.Enemy = null;
                    BattleRounds = 0;
                    GameManager.Explore();
                }
                else
                {
                    //The enemy attack the player
                    if (GameManager.CurrentPlayer.Enemy != null)
                    {
                        GameManager.CurrentPlayer.Enemy.Attack();
                        Message.Danger("\n" + GameManager.CurrentPlayer.Enemy.Name + " is attacking you ...");
                    }
                }
            }
        }      
        //------------------------------------------------------------------------------------------
        public static void Explore()
        {
            RNG dice = RNG.GetInstance();
            int random = dice.Next(0, 15);
            Console.WriteLine("\nYou are exploring ...");
            switch (random)
            {
                case 0:
                case 1:
                case 2:
                case 3:
                    Monster monster = GameFactory.CreateMonster();
                    Message.Danger(monster.Name + " approches ! Prepare for battle !");
                    //monster.SetTarget(GameManager.CurrentPlayer);
                    monster.Target = GameManager.CurrentPlayer;
                    GameManager.CurrentPlayer.Enemy = monster;
                    break;

                case 4:
                    Power magic_potion = GameFactory.CreateHealing();
                    Message.Warning("\nYou collect a Magic Potion !");
                    GameManager.CurrentPlayer.AddPower(magic_potion);
                    break;

                case 5:
                    Message.Warning("\nYou collect a Magic Cape !");
                    Power magic_cape = GameFactory.CreateInvisible();
                    GameManager.CurrentPlayer.AddPower(magic_cape);
                    break;
                case 6:
                    Message.Warning("\nYou collect a Wood Shield !");
                    Power shield = GameFactory.CreateProtect();
                    GameManager.CurrentPlayer.AddPower(shield);
                    break;
                case 7:
                    Message.Warning("\nYou collect a Sleepy Dust !");
                    Power magic_powder = GameFactory.CreateSleepy();
                    GameManager.CurrentPlayer.AddPower(magic_powder);
                    break;
                case 8:
                    Message.Warning("\nYou find a Big Rock !");
                    Weapon rock = GameFactory.CreateRock();
                    GameManager.CurrentPlayer.UpdateWeapon(rock);
                    break;

                case 9:
                    Message.Warning("\nYou find a Torch !");
                    Weapon torch = GameFactory.CreateTorch();
                    GameManager.CurrentPlayer.UpdateWeapon(torch);
                    break;
               
                case 10:
                    Message.Warning("\nYou find a Magic Sword !");
                    Weapon sword = GameFactory.CreateSword();
                    GameManager.CurrentPlayer.UpdateWeapon(sword);
                    break;
                case 11:
                    //Number of Gold Pieces is Random between 20 and 99
                    int random_gp = RNG.GetInstance().Next(50, 500);
                    Message.Warning("\nYou collect " + random_gp + " Gold Pieces !");
                    GameManager.CurrentPlayer.GP += random_gp;
                    break;
                default:
                    Console.WriteLine("\nYou are looking for gold pieces !");
                    break;
            }
        }
        
        
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.IO;
using System.Xml;
using System.Xml.Serialization;

namespace RPG_Game.Classes
{
    public static class DataXML
    {
        public static string path = @..\..\Data\;

        public static void Save(string file, List<Player> list)
        {
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.NewLineOnAttributes = true;

            using (XmlWriter writer = XmlWriter.Create(path + file, settings))
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<Player>));
                xmlSerializer.Serialize(writer, list);
            }
        }
        
        public static List<Player> Load(string file)
        {
            List<Player> data = null;
            using (StreamReader reader = new StreamReader(path + file))
            {
                XmlSerializer xml = new XmlSerializer(typeof(List<Player>));
                data = (List<Player>)xml.Deserialize(reader);
            }
            return data;
        }
    }
}
#include <iostream>;
#include <string>;
#include <random>;
using namespace std;

class Auto
{
public:
    void Start();
    void Accelerate();
    void Break();
    string model;
    string cylinder;

    Auto(string x, string y)
    {
        model = x;
        cylinder = y;
    }
};
void Start()
{
    cout << "Start\n";
}
void Accelerate()
{
    cout << "Accelerate\n";
}
void Break()
{
    cout << "Break\n";
}

int main()
{
    srand(time(NULL));

    int randomAction;
    int randomAuto;
    randomAction = (rand() % 3) + 1;
    randomAuto = (rand() % 3) + 1;

    switch (randomAction)
    {
    case 1:
        Start();
        break;
    case 2:
        Accelerate();
        break;
    case 3:
        Break();
        break;
    }

    Auto auto1("CADILAC", "5");
    Auto auto2("Ferrari", "7");
    Auto auto3("Lamborghini", "9");

    switch (randomAuto)
    {
    case 1:
        cout << "The model is: " << auto1.model << ", and the cylinder is: " << auto1.cylinder << endl;
        break;
    case 2:
        cout << "The model is: " << auto2.model << ", and the cylinder is: " << auto2.cylinder << endl;
        break;
    case 3:
        cout << "The model is: " << auto3.model << ", and the cylinder is: " << auto3.cylinder << endl;
        break;
    }
}
#include <stdlib.h>
#include <string>
#include <iostream>

using namespace std;

class nodes { //objet node
public :
    nodes() {
        next = NULL;
    }
    int element; //element dans la node
    nodes* next; //prochain element
}*front = NULL, *rear=NULL, *n, *temp, *temp1; //initialisation des variables

class circularqueue { //objet de la queue circulaire
public :
    //Fonctions des queues circulaire
    void InsertQueue(); 
    void Delete();
    void SearchQueue();
    void DisplayQueue();
};

//Fonction delete des queues circulaires
void circularqueue::Delete() {
    int x; // element à enlever
    temp = front; // temp devient la position de front
    if (front == NULL) { //Si pas de front (empty)
        cout << "The queue is empty" << endl;
    }
    else {
        if (front == rear) {//si positon de front est la meme que rear (un seul element)
            x = front->element; //x devient la valeur de front
            delete(temp); //enleve l'élément qui est à la position de temp(front)
            front = NULL; //Remet front à null
            rear = NULL;// remet rear à null
        }
        else {
            x = temp->element; //x devient la valeur de front (temp == front)
            front = front->next; //front devient le prochain élément
            rear->next = front; //la position de rear devient la position du prochain de front (rear devient l'ancien front)
            delete(temp); //eneleve l'élement temporaire
        }
        cout << "Element " << x << " has been deleted" << endl;
    }
}
void circularqueue::InsertQueue() {
    n = new nodes[sizeof(nodes)]; //crée un nouvel objet node
    cout << "Enter the element you wish to insert: ";
    cin >> n->element; //entrer l'élément de la nouvelle node
    if (front == NULL) { //si front est null
        front = n; //emplacement de front est maintenant la valeur entrée
    } else
    {
        rear->next = n; //position de rear devient le prochain
    }
    rear = n; //l'emplacement rear devient la valeur entrée
    rear->next = front; //position rear devient le prochain
}

void circularqueue::SearchQueue(){
    int search; // Valeur a chercher dans la queue
    int n = 0; //Compteur

    temp = front; // Valeur temporaire est à front;
    temp1 = NULL; // Autre valeur temp. est nulle

    if (front == NULL) { //Si front na pas d'élément
        cout << "The queue is empty..." << endl;
    }
    else {
        cout << "Enter the element you are searching for: ";
        cin >> search; //Enter l'élément à trouver

        while (temp != temp1) { //Fait pendant que la valeur temp != front
            if (search == temp->element) { //si le search est egal à l'élément de la node
                n++; //ajoute au compteur
                temp = temp->next; //change la valeur du front pour la prochaine valeur
                temp1 = front; //Deuxieme temporaire devient la valeur front
            }
        }
        cout << "The element " << search << " is in the queue " << n << " times." << endl;
    }
    return ;
}

void circularqueue::DisplayQueue() {
    temp = front; //temp devient la position de front
    temp1 = NULL; //deuxieme temp  est NULL
    if (front == NULL) { //si la front est vide
        cout << " The queue is empty..." << endl;
    }
    else { //si c'est pas vide
        cout << "The elements in the queue are: ";
        while (temp != temp1) { //pendant que temp n'est pas temp1 (le tour de la queue n'est pas complétée)
            cout << temp->element << " ";
            temp = temp->next; //temp devient la prochaine position
            temp1 = front; //temp 1 devient le front
        }
    }
 }
void OptionList() {
    cout << "1: Insert in the queue." << endl;
    cout << "2: Delete from the queue." << endl;
    cout << "3: Search the queue." << endl;
    cout << "4: Display the queue." << endl;
}
int main() {
    int opt; //option choisie
    bool whileTrue = true; //bool qui est toujours true pour options

    circularqueue Queue; //crée une nouvel object de circular queue
    
    //choisir un option
    while (whileTrue) {

        OptionList();

        cout << "Enter your desired option: ";
        cin >> opt;

        switch (opt) {
        case 1: Queue.InsertQueue();
            break;
        case 2: Queue.Delete();
            break;
        case 3:Queue.SearchQueue();
            break;
        case 4: Queue.DisplayQueue();
            break;
        }

    }
}
#include <iostream>
using namespace std;

class Rectangle
{
    public :
    int length;
    int breadth;

Rectangle(int l, int b)
{
    length = l;
    breadth = b;
}

int area()
{
    return length*breadth;
}

int perimeter()
{
    int p = 2*(length*breadth);
    return p;
}
};

int main() 
{
    int l,b;
    cout << "Enter length and breadth : ";
    cin >> l >> b;
    Rectangle r(l,b);
    
    int a = r.area();
    cout <<"Area is : "<<a << endl;
    
    int peri = r.perimeter();
    cout <<"perimeter is :"<<peri;

    return 0;
}
#include <iostream>
using namespace std;

struct rectangle
{
    int length;
    int breadth;
};

void initialize(struct rectangle *r, int l, int b)
{
    r->length = l;
    r->breadth = b;
}

int area(rectangle r)
{
    return r.length*r.breadth;
}

int perimeter(rectangle r)
{
    int p = 2*(r.length*r.breadth);
    return p;
}

int main() 
{
    rectangle r={0,0};
    int l,b;
    cout << "Enter length and breadth : ";
    cin >> l >> b;
    initialize(&r,l,b);
    
    int a = area(r);
    cout <<"Area is : "<<a << endl;
    
    int peri = perimeter(r);
    cout <<"perimeter is :"<<peri;

    return 0;
}
}
#include <iostream>
using namespace std;

int area(int length, int breadth)
{
    return length*breadth;
}

int perimeter(int length, int breadth)
{
    int p = 2*(length*breadth);
    return p;
}

int main() 
{
    int length = 0, breadth =0;
    cout << "Enter length and breadth : ";
    cin >> length >> breadth;
    
    int a = area(length,breadth);
    cout <<"Area is : "<<a << endl;
    
    int peri = perimeter(length,breadth);
    cout <<"perimeter is :"<<peri;

    return 0;
}
#include <iostream>
using namespace std;

int main() 
{
    int length = 0, breadth =0;
    cout << "Enter length and breadth : ";
    cin >> length >> breadth;
    
    int area = length*breadth;
    cout <<"Area is : "<<area << endl;
    
    int peri = 2*(length*breadth);
    cout <<"perimeter is :"<<peri;

    return 0;
}
kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1
import './ExpenseItem.css'
export default function ExpenseItem(){
    const expenseDate=new Date(2021,2,8)
    const expenseTitle='Car Insurance'
    const expenseAmount=123.354
    let arr=[2,3,4]
    console.log(typeof expenseDate)
   
    console.log(typeof arr)
    return(
        <div className='expense-item '>
            <div>
                {expenseDate.toISOString()}
            </div>
            <div className='expense-item__description'>
                <h2>
                 {arr}
                </h2>
            <div className='expense-item__price'>
            ${expenseAmount}
        </div>
        </div>
        </div>
    );
}
If you are just trying to serialize a list to disk for later use by the same python app, you should be pickleing the list --> https://docs.python.org/3/library/pickle.html

```
import pickle

with open('outfile', 'wb') as fp:
    pickle.dump(itemlist, fp)
```

To read it back:

```
with open ('outfile', 'rb') as fp:
    itemlist = pickle.load(fp)
```
#include <iostream>
using namespace std;

struct rectangle
{
  int length;
  int breadth;
};

struct rectangle *fun()
{
  struct rectangle *p;
  p = new rectangle;
  //p= (struct rectangle *)malloc(sizeof(struct rectangle));
  
  p->length = 15;
  p->breadth = 7;
  
  return p;
}

int main()
{
  struct rectangle *ptr = fun();
  cout << "length : "<<ptr->length<<endl<<"breadth : "<< ptr->breadth<<endl;
  
  return 0;
}
jbam.runme.all@previews.emailonacid.com
-----BEGIN PGP PUBLIC KEY BLOCK-----

mDMEZAciHRYJKwYBBAHaRw8BAQdAS8bXF9ezh72hChA5c13Jx9GU8Pt6dU+bSS8y
OGqBdGS0JEh1Z28gQWxtZWlkYSA8aGFsbWVpZGFAZXN0Zy5pcHZjLnB0PoiZBBMW
CgBBFiEERFi/2ErGnu5zH6s3SIJC63O9Bj8FAmQHIh0CGwMFCQPDvaMFCwkIBwIC
IgIGFQoJCAsCBBYCAwECHgcCF4AACgkQSIJC63O9Bj+NUwD/TKqSegRpnHPI2SdJ
jGzn/AyZzSQDWmkSxfDz6xA20YUBAIosSobsc/4LbUTNEJ7sXl+72D5ZIRAgiS/F
wP0hP5UOuDgEZAciHRIKKwYBBAGXVQEFAQEHQBc+vwHj0RdvfZVHbgMOkssjVc6F
kagg4GS41ao2ziMUAwEIB4h+BBgWCgAmFiEERFi/2ErGnu5zH6s3SIJC63O9Bj8F
AmQHIh0CGwwFCQPDvaMACgkQSIJC63O9Bj+QBQEAgnqFAf8+Kvbpky1/rSs/o0M+
TsZKX9fGRPvBaW8pzBAA/0YnlJ5Sxr1sGYnXL0DOaZmrOfT3oGGWkxHXHegRVnYM
=7Uhg
-----END PGP PUBLIC KEY BLOCK-----
var express = require('express')
var morgan = require('morgan')
var path = require('path')
var rfs = require('rotating-file-stream') // version 2.x
 
var app = express()
 
// create a rotating write stream
var accessLogStream = rfs.createStream('access.log', {
  interval: '1d', // rotate daily
  path: path.join(__dirname, 'log')
})
 
// setup the logger
app.use(morgan('combined', { stream: accessLogStream }))
 
app.get('/', function (req, res) {
  res.send('hello, world!')
})
#include <iostream>
using namespace std;

int fun(int size)
{
  int *p;
  p = new int[size];
  
  for(int i=0; i<size; i++)
    p[i]=i+1;
  return p;
}

int main()
{
  int *ptr, sz = 5;
  ptr = fun(sz);
  
  for(int i=0;i<sz;i++)
    cout << ptr[i]<<endl;
  
  return 0;
}
#include <iostream>
using namespace std;

void swap(int &x, int &y)      //passing the reference
{
  int temp;
  temp = x;
  x=y;
  y = temp;
}

int main()
{
  int a, b;
  a=10;
  b=20;
  swap(a,b);
  
  cout << "a = "<<a <<", b = "<<b << endl;     //a = 10, b = 20
  
  return 0;
}
#include <iostream>
using namespace std;
 
void swap(int *x, int *y)        //getting the pointers 
{
  int temp;
  temp = *x;
  *x=*y;
  *y = temp;
}
int main()
{
  int a, b;
  a=10;
  b=20;
  swap(&a,&b);          //passing the address
  
  cout << "a = "<<a <<", b = "<<b << endl;     //a = 10, b = 20
  
  return 0;
}
var path = require('path');
var http = require('http');
var fs = require('fs');

var dir = path.join(__dirname, 'public');

var mime = {
    html: 'text/html',
    txt: 'text/plain',
    css: 'text/css',
    gif: 'image/gif',
    jpg: 'image/jpeg',
    png: 'image/png',
    svg: 'image/svg+xml',
    js: 'application/javascript'
};

var server = http.createServer(function (req, res) {
    var reqpath = req.url.toString().split('?')[0];
    if (req.method !== 'GET') {
        res.statusCode = 501;
        res.setHeader('Content-Type', 'text/plain');
        return res.end('Method not implemented');
    }
    var file = path.join(dir, reqpath.replace(/\/$/, '/index.html'));
    if (file.indexOf(dir + path.sep) !== 0) {
        res.statusCode = 403;
        res.setHeader('Content-Type', 'text/plain');
        return res.end('Forbidden');
    }
    var type = mime[path.extname(file).slice(1)] || 'text/plain';
    var s = fs.createReadStream(file);
    s.on('open', function () {
        res.setHeader('Content-Type', type);
        s.pipe(res);
    });
    s.on('error', function () {
        res.setHeader('Content-Type', 'text/plain');
        res.statusCode = 404;
        res.end('Not found');
    });
});

server.listen(3000, function () {
    console.log('Listening on http://localhost:3000/');
});
#include <iostream>
using namespace std;

void swap(int x, int y)
{
  int temp;
  temp = x;
  x=y;
  y = temp;
}
int main()
{
  int a, b;
  a=10;
  b=20;
  swap(a,b);
  
  cout << "a = "<<a <<", b = "<<b << endl;     //a = 10, b = 20
  
  return 0;
}
<table>
  <thead>
    <tr>
      <th>Product Name</th>
      <th>Price</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Apples</td>
      <td>$1.00</td>
      <td>Fresh, juicy apples from the local orchard</td>
    </tr>
    <tr>
      <td>Oranges</td>
      <td>$1.50</td>
      <td>Sweet, tangy oranges from sunny Florida</td>
    </tr>
    <tr>
      <td>Bananas</td>
      <td>$0.75</td>
      <td>Ripe, yellow bananas picked at the peak of freshness</td>
    </tr>
  </tbody>
</table>
https://customdesign360.com/

https://binaro.io/.well-known/captcha/?r=%2F

https://www.tekrevol.com/

https://kojammedia.com/#move-up

https://animation-inc.com/

https://animista.net/play/background/bg-pan/bg-pan-top

https://animista.net/play/basic/rotate-90/rotate-90-cw

http://localhost/Web%20Studio-LP/
// disable for posts visual Composer back;
add_filter('use_block_editor_for_post', '__return_false', 10);
public function stkpush(Request $request)
{
    $url='https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest';

    $curl_post_data=[
        'BusinessShortCode'=>174379,
        'Password'=>$this->lipanampesapassword(),
        'Timestamp'=>Carbon::rawParse('now')->format('YmdHms'),

        'TransactionType'=> "CustomerPayBillOnline",
        'Amount'=>1,
        'PartyA'=>254712345678,
        'PartyB'=>174379,
        'PhoneNumber'=>254712345678,
        'CallBackURL'=>'https://89af-196-202-210-53.eu.ngrok.io/api/mpesa/callbackurl',
        'AccountReference'=>'Waweru Enterprises',
        'TransactionDesc'=>'Paying for Products Bought'
    ];

    $data_string=json_encode($curl_post_data);

    $curl=curl_init();
    curl_setopt($curl,CURLOPT_URL,$url);
    curl_setopt($curl,CURLOPT_HTTPHEADER,array('Content-Type:application/json','Authorization:Bearer '.$this->newaccesstoken()));
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($curl,CURLOPT_POST,true);
    curl_setopt($curl,CURLOPT_POSTFIELDS,$data_string);

    $curl_response=curl_exec($curl);
    return $curl_response;
}
push code into specific branch


To push code into a specific branch in Git, you can follow these steps:

First, make sure you are in the correct branch by running the command:

git branch


This will show you the list of branches in your local repository, and the branch that you are currently on will be marked with an asterisk (*).

If you are not in the correct branch, switch to the desired branch using the command:
php

git checkout -b <branch-name>
Replace <branch-name> with the name of the branch you want to switch to.

Once you are in the correct branch, add the changes you want to commit using the command:
csharp
Copy code
git add .
This will add all the changes in your current directory to the staging area.

Commit the changes using the command:
sql

git commit -m "commit message"
Replace "commit message" with a brief description of the changes you made.

Finally, push the changes to the remote repository using the command:
perl

git push origin <branch-name>
Replace <branch-name> with the name of the branch you want to push the changes to.

That's it! Your code changes should now be pushed to the specified branch in the remote repository
# исходный массив со строками
strs = ['дом', 'домен', 'домра', 'доширак']

# функция, которая найдёт общее начало
def simplelongestCommonPrefix (strs):
	# на старте общее начало пустое
	res = ""
	# получаем пары «номер символа» — «символ» из первого слова
	for i, c in enumerate(strs[0]): 
		# перебираем следующие слова в списке
		for s in strs[1:]: 
			# если это слово короче, чем наш текущий порядковый номер символа
			# или если символ на этом месте не совпадаем с символом на этом же месте из первого слова
			if len(s)<i+1 or s[i] != c: 
				# выходим из функции и возвращаем, что нашли к этому времени
				return res
		# если цикл выполнился штатно
		else:
			# добавляем текущий символ к общему началу
			res += c
	# возвращаем результат
	return res

# выводим результат работы функции
print(simplelongestCommonPrefix(strs))
star

Wed Mar 08 2023 11:10:51 GMT+0000 (Coordinated Universal Time)

@skfaizan2301 #react.js #javascript

star

Wed Mar 08 2023 10:29:59 GMT+0000 (Coordinated Universal Time)

@AlanaBF #javascript

star

Wed Mar 08 2023 10:22:27 GMT+0000 (Coordinated Universal Time)

@AlanaBF #javascript

star

Wed Mar 08 2023 09:31:50 GMT+0000 (Coordinated Universal Time) https://skeletonreact.com/

@kaipaeff

star

Wed Mar 08 2023 08:09:29 GMT+0000 (Coordinated Universal Time)

@russiasila

star

Wed Mar 08 2023 07:31:55 GMT+0000 (Coordinated Universal Time)

@eva_u

star

Wed Mar 08 2023 07:03:33 GMT+0000 (Coordinated Universal Time)

@Jackhihihihihi

star

Wed Mar 08 2023 05:50:17 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Wed Mar 08 2023 03:28:04 GMT+0000 (Coordinated Universal Time)

@JamonJamon #typescript

star

Tue Mar 07 2023 23:55:07 GMT+0000 (Coordinated Universal Time) https://www.tutorialspoint.com/math-abs-method-in-chash

@Hack3rmAn

star

Tue Mar 07 2023 23:44:05 GMT+0000 (Coordinated Universal Time) https://manuales.eikonsys.com/usuarios/como-crear-un-nuevo-usuario

@javicinhio

star

Tue Mar 07 2023 23:37:39 GMT+0000 (Coordinated Universal Time) https://www.reviso.com/es/ayuda/articulo/gestion-de-empresas/

@javicinhio

star

Tue Mar 07 2023 21:38:09 GMT+0000 (Coordinated Universal Time)

@kchan #css

star

Tue Mar 07 2023 21:19:40 GMT+0000 (Coordinated Universal Time) https://medium.com/@ashwinmali32/flutter-performance-optimization-tips-74cf76e0a505

@macdac

star

Tue Mar 07 2023 20:40:56 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/javascript/online-compiler/

@bhushan03

star

Tue Mar 07 2023 18:39:43 GMT+0000 (Coordinated Universal Time)

@Fwedy #java

star

Tue Mar 07 2023 18:28:11 GMT+0000 (Coordinated Universal Time)

@Fwedy #java

star

Tue Mar 07 2023 18:27:28 GMT+0000 (Coordinated Universal Time)

@marceloolima

star

Tue Mar 07 2023 17:23:20 GMT+0000 (Coordinated Universal Time)

@Fwedy #c#

star

Tue Mar 07 2023 17:15:01 GMT+0000 (Coordinated Universal Time)

@Fwedy #c#

star

Tue Mar 07 2023 17:07:27 GMT+0000 (Coordinated Universal Time)

@Fwedy #c++

star

Tue Mar 07 2023 16:58:09 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/how-to-convert-char-to-string-in-java/

@mohamed_javid

star

Tue Mar 07 2023 16:30:42 GMT+0000 (Coordinated Universal Time)

@Fwedy #c++

star

Tue Mar 07 2023 15:57:53 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 15:32:57 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 15:22:03 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 15:11:01 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 14:59:31 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

@Shokunbi

star

Tue Mar 07 2023 14:39:14 GMT+0000 (Coordinated Universal Time)

@abd #javascript

star

Tue Mar 07 2023 14:13:45 GMT+0000 (Coordinated Universal Time) https://store.steampowered.com/

@Nrnam

star

Tue Mar 07 2023 13:55:04 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/899103/writing-a-list-to-a-file-with-python-with-newlines

@quaie #python

star

Tue Mar 07 2023 13:52:21 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 13:27:52 GMT+0000 (Coordinated Universal Time)

@pernillerys

star

Tue Mar 07 2023 12:32:41 GMT+0000 (Coordinated Universal Time)

@Gimnath #javascript #npm #node

star

Tue Mar 07 2023 12:17:24 GMT+0000 (Coordinated Universal Time) https://elearning.ipvc.pt/ipvc2022/pluginfile.php/120088/mod_resource/content/1/Hugo Almeida_0x73BD063F_public.asc

@vanildo

star

Tue Mar 07 2023 10:09:46 GMT+0000 (Coordinated Universal Time) https://www.npmjs.com/package/morgan

@mtommasi

star

Tue Mar 07 2023 09:23:08 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 08:40:22 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 08:11:30 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/10637976/how-do-you-check-if-identity-insert-is-set-to-on-or-off-in-sql-server

@p83arch

star

Tue Mar 07 2023 08:04:03 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 08:02:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/5823722/how-to-serve-an-image-using-nodejs

@mtommasi #javascript #nodejs

star

Tue Mar 07 2023 07:53:14 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 07:06:12 GMT+0000 (Coordinated Universal Time) https://salesforcediaries.com/2023/01/08/flow-to-lwc-pass-data-instantly/

@pradeepkumar28

star

Tue Mar 07 2023 06:25:38 GMT+0000 (Coordinated Universal Time)

@shahzaibkhattak

star

Mon Mar 06 2023 23:30:45 GMT+0000 (Coordinated Universal Time) https://www.academia.edu/25202710/Mantenimiento_Compañías_concar

@javicinhio

star

Mon Mar 06 2023 23:04:35 GMT+0000 (Coordinated Universal Time)

@nofil

star

Mon Mar 06 2023 22:58:18 GMT+0000 (Coordinated Universal Time)

@nofil

star

Mon Mar 06 2023 21:16:04 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/72300328/post-api-mpesa-callbackurl-502-bad-gateway-in-ngrok-in-mpesa-integration

@eneki #php

star

Mon Mar 06 2023 20:13:11 GMT+0000 (Coordinated Universal Time)

@MuhammadAhmad #spreadoperator

Save snippets that work with our extensions

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