Skip to content

Instantly share code, notes, and snippets.

@mokanfar
mokanfar / cVimrc
Last active May 30, 2023 19:31
cVim Chrome Extension Settings
let scrollstep = 500
set noautofocus
set scalehints
set typelinkhints
let hintcharacters= "asdf"
let blacklists = ["https://www.notion.so/*","https://rootnroll.com/d/fish-shell/*","https://docs.google.com/spreadsheets/*"]
let mapleader = ","
unmap K e J j s d k w i m M o b t gg <S-g> <C-f> <C-k> <C-6>
@mokanfar
mokanfar / useful.sh
Last active August 5, 2020 19:45
Common Bash Commands
#=====tar up missing htaccess hidden files recursively from a parent directory and preserve folder structure=====#
find ./magento_dir -name "\.htaccess" | tar -cf missing_htaccess_files_and_dirs -T -
#=====general settings when setting up shell=====#
sudo chmod -R 755 /var/www
sudo chown -R $USER:$GROUP <dir>
sudo usermod -a -G root $USER
#=====insert 1 line beginning of file before everything else=====#
@mokanfar
mokanfar / csv_php_html.php
Last active August 29, 2015 14:22
CSV -> PHP Array -> HTML Generator
<?php
/**
* Convert a comma separated file into an associated array then spit out html string in variable.
* Useful for generating one-off html block fragrments.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
@mokanfar
mokanfar / indesign.indk
Created May 29, 2015 17:50
InDesign CS6 Shortcut Keys
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<shortcut-set platform="win" file-version="4" application-version="8.0" build-number="370">
<shortcut>
<action-id value="0x100 + 1" name="KBSCE File menu: New: :Document..."></action-id>
<context>DefaultContext</context>
<string>Ctrl+N</string>
</shortcut>
<shortcut>
<action-id value="0x100 + 3" name="KBSCE File menu:&amp;Open..."></action-id>
<context>DefaultContext</context>
{
"color_scheme": "Packages/Color Scheme - Default/Mariana.tmTheme",
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
"node_modules"
],
@mokanfar
mokanfar / mag-nightly.sh
Last active February 17, 2016 02:29
Magento Magmi Import Cron Bash Script
#!/bin/bash
####################### BEGIN CONFIG #######################
csv_sheet_url='http://dev.com/example.csv'
csv_sheet_path='/home/dev/magmi.csv'
tmp_file_path='/home/dev/tmp_magmi.csv'
magmi_cli_path='/home/dev/magmi/cli/magmi.cli.php'
log_file='/home/dev/log.txt'
profile='Default'
######################## END CONFIG ########################
@mokanfar
mokanfar / .zshrc
Last active November 5, 2015 00:31
.zshrc
alias g='cd /home/grunt/'
alias z='cd /vagrant/httpdocs/z/'
alias sync='browser-sync start --server --files "*.html,*.css" --config "/home/bs-config.js"'
alias hint='n98-magerun.phar --root-dir="/vagrant/httpdocs/mag/" dev:template-hints'
alias mt='sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant'
alias h='cd ~/'
alias zshrc='nano ~/.zshrc'
alias src='source ~/.zshrc'
bindkey -s "^[OM" "^M"
@mokanfar
mokanfar / conemu.xml
Last active February 21, 2018 18:19
ConEmu Settings
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2018-02-21 10:18:48" build="161206">
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{Git SCM Bash}"/>
<value name="StartFarFolders" type="hex" data="00"/>
<value name="StartFarEditors" type="hex" data="00"/>
<?php
/**
* Copy file or folder from source to destination, it can do
* recursive copy as well and is very smart
* It recursively creates the dest file or directory path if there weren't exists
* Situtaions :
* - Src:/home/test/file.txt ,Dst:/home/test/b ,Result:/home/test/b -> If source was file copy file.txt name with b as name to destination
* - Src:/home/test/file.txt ,Dst:/home/test/b/ ,Result:/home/test/b/file.txt -> If source was file Creates b directory if does not exsits and copy file.txt into it
* - Src:/home/test ,Dst:/home/ ,Result:/home/test/** -> If source was directory copy test directory and all of its content into dest
* - Src:/home/test/ ,Dst:/home/ ,Result:/home/**-> if source was direcotry copy its content to dest
@mokanfar
mokanfar / related_products.php
Last active August 12, 2016 16:51
Every Possible Relation PHP Script