Skip to content

Instantly share code, notes, and snippets.

Avatar

Luboš Hubáček Sekiphp

View GitHub Profile
View Show git branch name in console
# GIT bash integration
if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
source /usr/lib/git-core/git-sh-prompt
export GIT_PS1_SHOWCOLORHINTS=true
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWUPSTREAM="auto"
@Sekiphp
Sekiphp / Fix changes in submodule (-dirty commits)
Created May 18, 2022
Fix changes in submodule (-dirty commits)
View Fix changes in submodule (-dirty commits)
cd submodule
git reset --hard HEAD
git clean -fd .
cd ..
git submodule update --init --recursive
View Rebase multiple commits into one
1. git rebase --interactive HEAD~10
2. pick commit and replace `pick` for "child" commits to `s` (it means squash)
3. save & force push
@Sekiphp
Sekiphp / mysql-config
Created Apr 9, 2021
Mysql command in shell: settings put to ~/.my.cnf
View mysql-config
[mysql]
host=
port=
user=
password=
database=
View Update forked repository
# check if upstream is configured
git remote -v
git fetch # pull ahead commits from remote
git fetch upstream
git merge upstream/branch_name
git push
git log -n 5
View Git Aliases
git config --global alias.cm 'commit -m'
git config --global alias.st status
@Sekiphp
Sekiphp / Magento1 _websiteFilter callback on collection
Created Sep 2, 2019
Filtering on collection where is used method addWebsiteNamesToResult()
View Magento1 _websiteFilter callback on collection
protected function _websiteFilter($collection, $column)
{
if (!$value = $column->getFilter()->getValue()) {
return $this;
}
$stores = Mage::app()->getWebsite($value)->getStores();
foreach ($stores as $store) {
$collection->addStoreFilter($store);
}
@Sekiphp
Sekiphp / Automatically start ssh-agent on Windows
Created Jul 23, 2019
This code add to your .bashrc file. It is working for multiple sessions. Edited code of GitHub example.
View Automatically start ssh-agent on Windows
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
echo "Starting new SSH agent"
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ;
}
@Sekiphp
Sekiphp / Magento cron lister
Created Jun 18, 2019
This script lists all Magento cronjobs by this command: # clear && php /shell/cron_lister.php
View Magento cron lister
<?php
require_once __DIR__ . '/../abstract.php';
/**
* @see https://gist.github.com/werdan/5827225
*/
class Mage_Shell_CronLister extends Mage_Shell_Abstract
{
public function run()
@Sekiphp
Sekiphp / get-all-store-ids.txt
Created Apr 2, 2019
Magento 1 - get all active store IDS
View get-all-store-ids.txt
$allStores = Mage::getModel('core/store')
->getCollection()
->addFieldToFilter('is_active', ['eq' => 1])
->getAllIds();
var_dump(implode(',', $allStores));