Skip to content

Instantly share code, notes, and snippets.

View hitswa's full-sized avatar

Hitesh Kumar hitswa

View GitHub Profile
@hitswa
hitswa / samplegeneration.ipynb
Created March 12, 2024 06:13
SampleGeneration.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hitswa
hitswa / import.reg
Created March 23, 2020 05:54
registry for adding "open folder as VC Code Project" in context menu
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@hitswa
hitswa / enviornment.js
Last active February 7, 2020 03:35
functions to get enviornment details
function getIP() {
detectIP().then((ip)=>{ return ip }).catch((error)=>{ console.log({error}); return null; });
}
function getBrowser() {
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE ' + (tem[1] || '');
@hitswa
hitswa / search.html
Created June 20, 2019 03:24
jQuery based search
<!DOCTYPE html>
<html>
<head>
<title>Search</title>
<style type="text/css">
ul#searchList {
list-style-type: none;
list-style-position: inside;
display:block;
position:relative;
@hitswa
hitswa / install_phpdoc.sh
Created March 21, 2019 09:41
instaling phpdoc in ubuntu
sudo apt-get install php-pear
sudo pear channel-discover pear.phpdoc.org
sudo pear install phpdoc/phpDocumentor
@hitswa
hitswa / VSCodeExtension.py
Created November 25, 2018 15:35 — forked from harry-cpp/VSCodeExtension.py
VSCode extension for Nautilus
# VSCode Nautilus Extension
#
# Place me in ~/.local/share/nautilus-python/extensions/, restrart Nautilus, and enjoy :)
# mkdir -p ~/.local/share/nautilus-python/extensions && cp -f VSCodeExtension.py ~/.local/share/nautilus-python/extensions/VSCodeExtension.py && nautilus -q
#
# This script was written by cra0zy and is released to the public domain
from gi import require_version
require_version('Gtk', '3.0')
require_version('Nautilus', '3.0')
@hitswa
hitswa / detech_browser.js
Created September 14, 2018 20:37
detect browser
// method one https://stackoverflow.com/revisions/9851769/1
var isOpera = !!(window.opera && window.opera.version); // Opera 8.0+
var isFirefox = testCSS('MozBoxSizing'); // FF 0.8+
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// At least Safari 3+: "[object HTMLElementConstructor]"
var isChrome = !isSafari && testCSS('WebkitTransform'); // Chrome 1+
var isIE = /*@cc_on!@*/false || testCSS('msTransform'); // At least IE6
function testCSS(prop) {
return prop in document.documentElement.style;
@hitswa
hitswa / search.sql
Last active September 14, 2018 20:24
Complex Search results query MySQL
SELECT
edu.*,
Educator.*,
cCat.`courseObjectiveName`,
cGoal.`courseGoalName`,
cTop.`courseExamName`,
cCon.`courseSubjectName`
FROM ".EducatorCoursesModel::$coursesTableName." AS edu
LEFT JOIN " . courseObjectiveModel::$tableName . " AS cCat
ON edu.`courseObjectiveId`=cCat.`courseObjectiveId`
@hitswa
hitswa / payumoney.php
Last active July 1, 2018 18:43
custom easy to implement PayUMoney page to send payment request
<?php
$MERCHANT_KEY = "xxxxxxxx"; // replace with marchent key
$SALT = "xxxxxxxxx"; // replace with salt
$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
$surl = 'http://xxxxxxx.com/payment_response'; // replace with success url
$furl = 'http://xxxxxxx.com/payment_response'; // replace with fail url
$curl = 'http://xxxxxxx.com/payment_response'; // replace with cancel url
$action = 'https://sandboxsecure.payu.in/_payment'; // sandbox url
@hitswa
hitswa / safe_json_conversion.php
Last active September 4, 2018 22:06
conversion of Array to JSON safely
<?php
function utf8ize($d) {
if (is_array($d)) {
foreach ($d as $k => $v) {
$d[$k] = utf8ize($v);
}
} else if (is_string ($d)) {
// return utf8_encode($d);
return iconv(mb_detect_encoding($d), "UTF-8", $d);