Skip to content

Instantly share code, notes, and snippets.

View infinite4evr's full-sized avatar
😇
Focusing

Sudhanshu Kumar infinite4evr

😇
Focusing
View GitHub Profile
@infinite4evr
infinite4evr / Vscode.json
Created September 13, 2022 02:36
Vscode Sync
hello
@infinite4evr
infinite4evr / Normalize.php
Created October 21, 2020 04:26
Laravel normalizer
<?php
namespace App\Helpers;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use stdClass;
const tick = () => {
console.log(count); //logs new value
setCount((prevCount) => prevCount + 1);
};
useEffect(() => {
const interval = setInterval(tick, 1000);
return () => {
clearInterval(interval);
};
const tick = () => {
console.log(count); //will log 0 forever
setCount((prevCount) => prevCount + 1);
};
useEffect(() => {
const interval = setInterval(tick, 1000);
return () => {
clearInterval(interval);
};
import React, { useEffect, useState } from "react";
export default function IntervalCounter() {
const [count, setCount] = useState(0);
const tick = () => {
console.log(count);
setCount(count + 1);
};
let i=0; while(i<=100){ setTimeout(function(){window.scrollTo(0,document.body.scrollHeight)}, i*500); ++i;}
@infinite4evr
infinite4evr / scanrss_14.html
Created March 4, 2020 06:21
RSS _14 Continuous scan Issue
<html>
<body>
<button>Start Scan</button>
<video id="video" width="100%" height="100%" style="border: 1px solid gray"></video>
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/@zxing/library@latest"></script>
<script>
let selectedDeviceId;
@infinite4evr
infinite4evr / my_bot.php
Last active September 15, 2019 08:59
bot_tutorial
<?php
$bot_token = "980569822:AAGmatHbU5tMQoAN9hNNP5P3SGOqibfatVI"; // token by botfather
$bot_api_url = "https://api.telegram.org"; //api url to request
$request_updates_url = $bot_api_url."/bot".$bot_token."/getUpdates"; // final request url ( see telegram api documentation )
$send_message_url = $bot_api_url."/bot".$bot_token."/sendMessage"; // method for sending message is sendMessage
/*
$request url now is : "https://api.telegram.org/bot980569822:AAGmatHbU5tMQoAN9hNNP5P3SGOqibfatVI/getUpdates"
@infinite4evr
infinite4evr / sh
Created August 21, 2019 03:47
mysql_password_reset
1
Below is the process to reset the root user password, when we forgot the root user password or missed to recollect the password provided during installation.
OS - Ubuntu 16.04
MySQL - 5.7
Stop Mysql Server sudo /etc/init.d/mysql stop
To avoid the error, mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists , run below commands: sudo mkdir -p /var/run/mysqld
@infinite4evr
infinite4evr / hamming_code.cpp
Created January 7, 2019 03:39
Hamming Code Implementation in C+
//Post at : https://medium.com/code01/hamming-code-implementation-in-c-c16f3d038ba1
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
using namespace std;
int
main ()
{