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 / magento2_reset_password.txt
Created October 23, 2018 13:47
Magento 2 Reset Customer Password SQL query
UPDATE `customer_entity`
SET `password_hash` = CONCAT(SHA2('xxxxxxxxYOURPASSWORD', 256), ':xxxxxxxx:1') // change YOURPASSWORD to your password to reset
WHERE `entity_id` = 19975 and `email`="[email protected]";
@GideonBabu
GideonBabu / Useful MySql Commands
Last active November 6, 2019 15:15
Useful MySQL Commands
ALTER TABLE master_activity_log CHANGE `from_user_id` `user_id` INT(11); // change column name
ALTER TABLE master_activity_log DROP log_date; // remove column
ALTER TABLE master_activity_log ADD COLUMN log_datetime DATETIME AFTER after_save; // create new column of existing table
Truncate foreign key constraints table :
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `table name`;
SET FOREIGN_KEY_CHECKS=1;
@GideonBabu
GideonBabu / example-app
Created November 22, 2018 13:33
Setup Logrotate on the server
/var/www/html/var/log/*.log {
daily
missingok
rotate 14
compress
notifempty
create 0777 www-data www-data
}
setup cron job
@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!';
@GideonBabu
GideonBabu / magento2-logrotate.conf
Created December 12, 2018 07:43
Magento 2 Log rotate
/var/www/html/var/log/*.log {
daily
missingok
rotate 14
compress
notifempty
create 0777 magento2-file-username magento2-file-username
}
@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 / PHP-7-New-Features.txt
Last active February 21, 2019 07:34
PHP 7 features and brief notes
Better performance - PHP 7 is twice as fast as PHP 5.6. Optimization
Scalar type declarations - pass function params with variable type
function sum (int $a, int $b){
}
Return type declarations - mention the return variable type of a function
function sum ($a, $b): int{
@GideonBabu
GideonBabu / iphone_disable_autozoom_input.css
Created November 21, 2019 13:07 — forked from vedranjaic/iphone_disable_autozoom_input.css
css: iPhone - Disable auto-zoom on input fields
/*
* disable auto-zoom on iphone input field focus
* http://www.456bereastreet.com/archive/201212/ios_webkit_browsers_and_auto-zooming_form_controls/
*/
input[type='text']:focus,
input[type='number']:focus,
textarea:focus {
font-size: 16px;
}
@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 / GestureCallback Helper Class - Mobile Webkit
Created November 26, 2019 16:35 — forked from ashishpuliyel/GestureCallback Helper Class - Mobile Webkit
Class to handle touch gestures for scale and rotate (pinch to zoom) on Mobile webkit
/*
This is from
http://uihacker.blogspot.com/2011/04/javascript-handle-touch-gestures-for.html
I wrote a little class to handle pinch & rotate gestures on a web page in iOS. There's a bunch of event listener adding/removing, which can get a little messy, so this should help keep your code clean if you need to handle gestures.
Here's the class:
*/
function GestureCallback( element, endCallback, changeCallback ) {