Skip to content

Instantly share code, notes, and snippets.

View akhileshdarjee's full-sized avatar
😉
Unstoppable Today

Akhilesh Darjee akhileshdarjee

😉
Unstoppable Today
View GitHub Profile
@akhileshdarjee
akhileshdarjee / Mailgun PHPMailer SMTP integration.php
Last active December 10, 2022 22:23
Mailgun PHPMailer SMTP integration
<?php
/**
* This example shows settings to use when sending via Mailgun.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Asia/Kolkata');
require 'PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
@akhileshdarjee
akhileshdarjee / best htaccess file for Apache2
Created April 22, 2019 12:39
Best htaccess file for Apache2
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
# Enable Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
@akhileshdarjee
akhileshdarjee / git shortcuts for local development for ubuntu
Created April 22, 2019 12:41
Git shortcuts for local development for Ubuntu
#Open ~/.bashrc file and past the following code at the end
alias gs='git status'
alias ga='git add -A'
alias gc='git commit -a -m $1'
alias gp='git push origin master'
alias gpl='git pull origin master'
@akhileshdarjee
akhileshdarjee / send files images and documents via ajax.html
Last active January 2, 2021 14:43
send files, images or documents via AJAX
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Form</title>
</head>
<body>
<input type="hidden" name="user_id" value="1">
<form name="user-form" id="user-form" enctype="multipart/form-data">
<input type="file" name="image_file">
<input type="text" name="name">
@akhileshdarjee
akhileshdarjee / Responsive Modal LightBox with CSS & JS (no plugins).html
Last active January 2, 2021 14:46
Responsive Modal LightBox with CSS & JS (no plugins)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Fancybox</title>
<style type="text/css">
/* Fancybox */
.fancyimg {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
@akhileshdarjee
akhileshdarjee / render image file in html5.html
Created April 22, 2019 12:56
Render image file in HTML5
<!DOCTYPE html>
<html lang="en">
<body>
<form name="user-form" id="user-form" enctype="multipart/form-data">
<input type="file" name="image_file">
<input type="text" name="name">
<img src="" id="image_file">
<button type="button" title="Save" id="save-user">Save</button>
</form>
<script type="text/javascript">
@akhileshdarjee
akhileshdarjee / back to top responsive html button.html
Created April 22, 2019 12:57
Back to Top Responsive HTML button
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
a.back-to-top {
display: none;
text-align: center;
line-height: 50px;
width: 50px;
height: 50px;
@akhileshdarjee
akhileshdarjee / touch swipe events for touch devices in javascript.js
Created April 22, 2019 13:04
Touch Swipe like Swipe Left, Swipe Right, Swipe Up and Swipe Down events for touch devices in Javascript
var xDown = null;
var yDown = null;
document.addEventListener('touchstart', handleTouchStart, false);
document.addEventListener('touchmove', handleTouchMove, false);
function handleTouchStart(evt) {
xDown = evt.touches[0].clientX;
yDown = evt.touches[0].clientY;
};
@akhileshdarjee
akhileshdarjee / binding direction arrow keys.js
Created April 22, 2019 13:09
Binding Direction Arrow Keys Up, Down, Left and Right in Javascript
document.onkeydown = function(e) {
switch(e.which) {
case 37:
// left direction
break;
case 38:
// up direction
break;
@akhileshdarjee
akhileshdarjee / mouse move direction events in javascript.js
Created April 22, 2019 13:31
Mouse move direction events in javascript
var last_position = {};
document.onmousemove = function(e) {
//check to make sure there is data to compare against
if (typeof(last_position.x) != 'undefined') {
//get the change from last position to this position
var deltaX = last_position.x - event.clientX,
deltaY = last_position.y - event.clientY;