Skip to content

Instantly share code, notes, and snippets.

View codesharpdev's full-sized avatar
🏠
Working from home

Salman Saifi codesharpdev

🏠
Working from home
View GitHub Profile
@codesharpdev
codesharpdev / git-aliases.md
Created June 7, 2024 07:04 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@codesharpdev
codesharpdev / worktree-publish-to-gh-pages.md
Created January 26, 2023 18:32 — forked from lajlev/worktree-publish-to-gh-pages.md
Publishing a `dist` folder from `master` branch using **worktree** feature to `gh-pages` branch.

Setup

First of all, you need to have a gh-pages. If you don't have, create:

git branch gh-pages

This makes a branch based on the master HEAD. It would be okay but the files and the git history of master branch are not meaningful on gh-pages branch.

@codesharpdev
codesharpdev / .htaccess
Created November 22, 2022 17:24 — forked from jiceb/.htaccess
Remove trailing slash with .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# where the magic is done !
RewriteRule (.*)/$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@codesharpdev
codesharpdev / db.php
Created June 20, 2022 13:02 — forked from miguelfrmn/db.php
MySQL database helper class
<?php
/**
* @name Database class
* @author Miguel Fermín
* @copyright 2013
* @license MIT
* @license http://opensource.org/licenses/MIT
*/
class DataBase {
@codesharpdev
codesharpdev / pagination.cfm
Created August 16, 2017 12:51 — forked from steinbring/pagination.cfm
How to do pagination within ColdFusion This is an example of how to handle pagination in ColdFusion. This simple example can be manipulated by changing the values of the four variables at the top of the file.
<!--- How many pages should you link to at any one time? --->
<cfset intPagesToLinkTo = 5>
<!--- How many items are you displaying per page? --->
<cfset intItemsPerPage = 10>
<!--- How many items do you need to display, across all pages. --->
<cfset intNumberOfTotalItems = 100>
<!--- What is the current page you are on? --->
<cfif isdefined("url.page")>
<cfset intCurrentPage = val(url.page)>
<cfelse>
@codesharpdev
codesharpdev / wordpress.web.config.xml
Created February 24, 2017 07:44 — forked from chrisdempsey/wordpress.web.config.xml
web.config for Wordpress by SAOTN
<!-- source: https://www.saotn.org/my-wordpress-web-config/ -->
<?xmlversion="1.0"encoding="UTF-8"?>
<configuration>
<configSections>
<!--
Load HttpBL assembly to keep suspicious and malicious web robots
out. Get your Access Key @ https://www.projecthoneypot.org/create_account.php
-->
<section name="HttpBL" type="HttpBL.Settings" />
@codesharpdev
codesharpdev / gist:fea467faa34beb56ecf8c50ebe3bc559
Created January 17, 2017 11:44 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@codesharpdev
codesharpdev / index.js
Created November 1, 2016 20:27 — forked from cynx/index.js
index.js - no vertical scroll
$(document).ready(function () {
$('#datatab tfoot th').each(function () {
$(this).html('<input type="text" />');
});
var oTable = $('#datatab').DataTable({
"serverSide": true,
"ajax": {