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 / 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 / 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;
@akhileshdarjee
akhileshdarjee / javascript useful functions and prototypes.js
Created April 22, 2019 13:32
Javascript useful functions/protoytpes
// convert string to proper case
String.prototype.toProperCase = function () {
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
};
// convert string to snake case
String.prototype.toSnakeCase = function () {
return this.replace(/(.)([A-Z])/g, "$1_$2").toLowerCase();
};
@akhileshdarjee
akhileshdarjee / use proxy in laravel
Created April 22, 2019 14:11
Use Proxy in Laravel
Use the following parameters in .env file:
HTTPS_PROXY={http/https://}PROXY_USER:PROXY_PWD@PROXY:PROXY_PORT
(Combination of Proxy Address:Proxy Password@Proxy Address with port, don’t include http/https)
PROXY=xxxxxx (Proxy Name)
PROXY_PORT=xxxx (Proxy Port)
PROXY_USER=xxxxxxxxx (Proxy User Name)
PROXY_PWD=xxxxxxxxx (Proxy User Password)
PROXY_TYPE=CURLPROXY_HTTP
@akhileshdarjee
akhileshdarjee / change public directory in laravel
Created April 22, 2019 14:17
Change public directory in Laravel
1. Cut all the files and folders in public directory and paste it to root folder
2. Update the index.php as below:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
@akhileshdarjee
akhileshdarjee / access mysql remote access
Created April 22, 2019 14:22
Access MySQL remote access
mysql -u {user_name} -p -h {IP} -D {database_name}
Parameters:
user_name: MySQL user name on remote server
IP: IP Address of remote server
database_name: Name of the database on remote server
@akhileshdarjee
akhileshdarjee / best way to apply bootstrap tooltip across the application.js
Created April 22, 2019 14:31
Best way to apply bootstrap tooltip across the application
$("body").tooltip({
selector: '[data-toggle="tooltip"]',
trigger : 'hover'
});
// selector: This method helps to initialise tooltips and works even if tooltip is generated dynamically
// trigger: This will show tooltip only when the cursor is placed on the element.
// When clicked on any element or button, the tooltip stays intact even if the cursor if not placed on it.
// The 'trigger' method helps to solves this issue and show only when cursor is placed on the element