Skip to content

Instantly share code, notes, and snippets.

:octocat:
PRO

Amir Hassan Azimi hassanazimi

:octocat:
PRO
Block or report user

Report or block hassanazimi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ChatRoom.vue
<template>
<div class="chat">
<transition-group enter-active-class="fadeIn">
<div v-for="(msg, index) in messages" :key="index" class="messages">
<div :class="index % 2 === 0 ? 'message2' : 'message1'">
<div :class="index % 2 === 0 ? 'msg2' : 'msg1'">{{ msg }}</div>
</div>
</div>
</transition-group>
<textarea v-model.trim="message" @keyup.enter="send" cols="30" rows="3"></textarea>
@hassanazimi
hassanazimi / Bash.sh
Last active May 22, 2019
Useful Bash Commands.
View Bash.sh
#!/bin/bash
##############################################################################
# SHORTCUTS
##############################################################################
CTRL+A # move to beginning of line
CTRL+C # halts the current command
CTRL+E # moves to end of line
CTRL+K # deletes (kill) forward to end of line
CTRL+L # clears screen and redisplay the line
@hassanazimi
hassanazimi / Vim.md
Last active May 16, 2019
Vim Cheatsheet! The shortcuts and keys that escape from mind. Rest of the keys are too easy to include.
View Vim.md

Global

  • e - jump forwards to the end of a word
  • b - jump backwards to the start of a word
  • 0 - jump to the start of the line
  • $ - jump to the end of the line
  • gg - go to the first line of the document
  • G - go to the last line of the document
  • / - seach and enter
  • } - jump to next paragraph (or function/block, when editing code)
  • { - jump to previous paragraph (or function/block, when editing code)
@hassanazimi
hassanazimi / Unix.md
Last active May 18, 2019
Unix Cheetsheet! These cheat sheets are the most command and practises I need to work more on them to remember them. There isn't everything here included because I know most of the simple ones.
View Unix.md

SHORTCUTS

  • ctrl+a — move cursor to beginning of line
  • ctrl+e — move cursor to end of line
  • ctrl+u — clear to beginning of line
  • ctrl+k — clear to end of line

FILE SYSTEM

  • cp -r dir1 dir - copy directory dir1 to dir2
  • ln -s file link — create soft symbolic link to file (soft)
  • ln file link — create hard symbolic link to file (hard)
View small_window_browser.html
<a href="#"
onclick="javascript:window.open(
'index.html',
'Window Name',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=300,height=300'
); return false">
Click
</a>
@hassanazimi
hassanazimi / find_and_replace.md
Last active May 13, 2019
FInd and replace Unix
View find_and_replace.md
  1. Replacing all occurrences of one string with another in all files in the current directory: These are for cases where you know that the directory contains only regular files and that you want to process all non-hidden files. If that is not the case, use the approaches in 2.

All sed solutions in this answer assume GNU sed. If using FreeBSD or OS/X, replace -i with -i ''. Also note that the use of the -i switch with any version of sed has certain filesystem security implications and is inadvisable in any script which you plan to distribute in any way.

Non recursive, files in this directory only:

sed -i -- 's/old/new/g' *
perl -i -pe 's/old/new/g' ./* 
@hassanazimi
hassanazimi / regex.md
Created May 13, 2019 — forked from jacurtis/regex.md
Most Useful Regex's
View regex.md

Useful Regular Expressions

These are the most useful Regular Expressions that I find myself using on a regular basis


URLs

Test to see if a string is a valid website address or not.

All URLs
View no-right-click-on-images.js
/*
* This script will look for all images on a page and prevent right clicking on an image.
*/
const images = document.getElementsByTagName('img');
for(var i = 0; i < images.length; i++) {
images[i].addEventListener('contextmenu', event => event.preventDefault());
}
// Note: I threw this script together as requested by a subscriber. I personally don't recommend doing
@hassanazimi
hassanazimi / .vimrc
Last active Sep 24, 2019
Personal .vimrc file with ~/.vim/plugins.vim file and Vundle installed (https://github.com/VundleVim/Vundle.vim)
View .vimrc
so ~/.vim/plugins.vim " Source from plugins
set nocompatible " Disable vi-compatibility
syntax on " Enable syntax highlighting
" Pathogen plugin specific
execute pathogen#infect()
filetype plugin indent on " Pathogen
set background=dark " Set bg to dark
@hassanazimi
hassanazimi / forge.sh
Created Aug 9, 2018 — forked from radermacher/forge.sh
Laravel Forge Setup Script
View forge.sh
#
# REQUIRES:
# - server (the forge server instance)
# - event (the forge event instance)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - callback (the callback URL)
#
You can’t perform that action at this time.