Skip to content

Instantly share code, notes, and snippets.

View GideonBabu's full-sized avatar
💭
Looking for a challenging opportunity

Gideon Babu GideonBabu

💭
Looking for a challenging opportunity
View GitHub Profile
@GideonBabu
GideonBabu / gitcommands.txt
Last active August 26, 2020 19:09
Useful Git Commands
git clone [git URL] - to clone the URL from gitlab/github/bitbucket
git branch -a - to list current to remote branch
git checkout [branch name] - to move/checkout to branch name
git status - to view the status of the local files and remote branch files in cloud
git diff [file] - to view the different between local and remove file
git add [files with a space] - to add new files to the repo
git commit -m "commit msg" - to commit with message
git push - push the code to the repo
# add remote
@GideonBabu
GideonBabu / System Design.md
Created June 27, 2020 09:45 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@GideonBabu
GideonBabu / Company\Module\Block\Product\ProductList\Toolbar.php
Last active March 5, 2020 12:36
Magento 2: Product sorting high to low and low to high
<?php
namespace Company\Module\Block\Product\ProductList;
class Toolbar extends \Magento\Catalog\Block\Product\ProductList\Toolbar
{
public function setCollection($collection) {
$this->_collection = $collection;
$this->_collection->setCurPage($this->getCurrentPage());
@GideonBabu
GideonBabu / Phpstorm_tips.txt
Last active January 30, 2020 12:56
PhpStorm tips
You can compare two table structures and see the differences in columns, keys, indexes, and other structural table elements. In the Database tool window (View | Tool Windows | Database), select two tables. Right-click the selection and navigate to Compare Ctrl+D.
To compare contents of two tables, right-click two tables and navigate to Compare Content.
+++
You can add a brief description of any breakpoint to ease search in future.
Press Ctrl+Shift+8 to view all existing breakpoints, then right-click the breakpoint you want to provide a description for, and choose Edit description
+++
@GideonBabu
GideonBabu / javascript_naming_convention.txt
Created January 30, 2020 12:48
JavaScript Best Practices and Naming convention
JavaScript variable naming:
1. Names can contain letters, digits, underscores, and dollar signs.
2. Names must begin with a letter
3. Names can also begin with $ and _ (but we will not use it in this tutorial)
4. Names are case sensitive (y and Y are different variables)
5. Reserved words (like JavaScript keywords) cannot be used as names
@GideonBabu
GideonBabu / javascript_code_snippets_for_day_today_work.js
Last active January 28, 2020 08:50
Useful JavaScript (JS) or jQuery snippets for day-to-day Software Development
// detect the Enter key in a text input field
$(".input1").on('keyup', function (e) {
if (e.keyCode === 13) {
// Do something
}
});
// array for..of cycle
// tip: you can stop iterating at any time using a break statement.
@GideonBabu
GideonBabu / svn_useful_commands.txt
Created January 22, 2020 10:27
SVN useful commands
// to revert a file
svn revert filename
// to revert all the files inside folder named [htdocs]
// http://svnbook.red-bean.com/en/1.8/svn.ref.svn.c.revert.html
cd htdocs
svn revert -R .
@GideonBabu
GideonBabu / Useful_PHP_Scripts.txt
Last active January 15, 2020 10:37
Useful PHP Scripts
To split the date and time from datetime value
$date = strtotime('8/29/2011 11:16:12 AM');
$dat = date('m/d/y', $date);
$tme = date('H:m:s A',$date);
ucfirst() - makes the first letter of the input string uppercase.
upfirst('hello world!') - returns 'Hello world!';

[abc] A single character: a, b or c
[^abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
$ End of line
\A Start of string
\z End of string
. Any single character
\s Any whitespace character