Skip to content

Instantly share code, notes, and snippets.

View hayskytech's full-sized avatar

Sufyan Haysky hayskytech

View GitHub Profile
Ctrl + A ---> Select All
Ctrl + B ---> Bold
Ctrl + F ---> Find
Ctrl + H ---> Replace
Ctrl + C ---> Copy
Ctrl + X ---> Cut
Ctrl + V ---> Paste
Ctrl + P ---> Print
Ctrl + S ---> Save
Ctrl + Shift + S ---> Save As
<iframe
id="map"
width="300"
height="170"
frameborder="0"
scrolling="no"
marginheight="0"
marginwidth="0"
src="https://maps.google.com/maps?q=15.855495, 78.258275&hl=es;z=14&output=embed"
>
<input type="text" />
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/redmond/jquery-ui.css">
<script type="text/javascript">
var array = ["2019-12-23","2013-03-15","2013-03-16"];
var dateToday = new Date();
$('input').datepicker({
// defaultDate: "+1w",
changeMonth: true,
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script type="text/javascript" src="https://unpkg.com/canvg@3.0.4/lib/umd.js"></script>
<button id="editor_save">OK</button>
<canvas id="canvas" style="display: none"></canvas>
<img src="">
<script type="text/javascript">
$("#editor_save").click(function() {
var x = $("#editor").html();
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
<input type="file" id="imageUpload" onchange="previewImage()">
<div id="imagePreview"></div>
<script type="text/javascript">
function previewImage() {
var preview = document.getElementById('imagePreview');
img = document.getElementById('imageUpload').files[0];
var reader = new FileReader();
if (img) {
reader.readAsDataURL(img);
} else {
<script type="text/javascript">
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
<div id="myElement">
<h1>My Title</h1>
<p>Some text...</p>
</div>
<button onclick="downloadAsImage()">Download as Image</button>
<button onclick="downloadAsPDF()">Download as PDF</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.2/html2canvas.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script>
@hayskytech
hayskytech / Prevent-form-resubmit.html
Created January 27, 2023 15:25
Prevent form resubmission when page is refreshed.
<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<?php
$args = array(
'taxonomy' => 'place',
'parent' => 0,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => true, //can be 1, '1' too
'number' => false, //can be 0, '0', '' too
'offset' => '',
'fields' => 'all',
@hayskytech
hayskytech / preselect-category-new-post.php
Last active December 30, 2022 04:33
preselect-category-new-post.php
<?php
function ws_preselect_post_category() {
if ( isset($_GET['category']) && is_numeric($_GET['category']) ) {
$catId = intval($_GET['category']);
?>
<script type="text/javascript">
jQuery(function() {
var catId = <?php echo json_encode($catId); ?>;
jQuery('#in-category-' + catId).click();
});