Skip to content

Instantly share code, notes, and snippets.

Saeid Mohadjer smohadjer

Block or report user

Report or block smohadjer

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
@smohadjer
smohadjer / vhost_mac.md
Last active Feb 16, 2020
Updating virtual host on Mac
View vhost_mac.md
  1. Uncomment the following line in httpd.conf located at /etc/apache2/ on Mac:
    # Virtual hosts
    #Include /private/etc/apache2/extra/httpd-vhosts.conf
    
  2. Add below snippet to /etc/apache2/extra/httpd-vhosts.conf:
    <VirtualHost *:80>
    ServerName html.launcher
    
@smohadjer
smohadjer / MariaDB.md
Last active Feb 21, 2020
Tips on using MariaDB
View MariaDB.md
my.cnf  /usr/local/etc
Sequel Pro: https://www.sequelpro.com/

To find processes running and killing them
ps -ax | grep mysql
kill processPID

brew install mysql@5.7
brew link --force mysql@5.7
@smohadjer
smohadjer / mariadb_time_zone_mac.md
Last active Feb 21, 2020
Setting MariaDB time zone to UTC on macOS
View mariadb_time_zone_mac.md

Setting Time Zone of MariaDB to UTC

  1. If you are logged in then exit mariadb and stop it via: brew services stop mariadb
  2. To populate time zone tables: To load the time zone tables from the command line, pass the zoneinfo directory path name to mysql_tzinfo_to_sql and send the output into the mysql program. If your root user has no password drop -p from below command:
    mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
    
  3. Open my.cnf (/usr/local/etc) and add following lines to it:
    [mysqld]
    default_time_zone='UTC'
    
@smohadjer
smohadjer / yii2.md
Last active Feb 21, 2020
Collection of yii2 snippets
View yii2.md

To hide Yii debugger comment out following code in config/web.php:

	$config['bootstrap'][] = 'debug';
	$config['modules']['debug'] = [
		'class' => 'yii\debug\Module',
		// uncomment the following to add your IP if you are not connecting from localhost.
		//'allowedIPs' => ['127.0.0.1', '::1'],
	];
@smohadjer
smohadjer / animate.js
Last active Sep 14, 2018
Scroll page via jQuery without invoking callback twice
View animate.js
//we use a promise so that callback is not invoked twice
$('html, body').animate({
scrollTop: top
}, 1000).promise().then(function() {
if (callback) {
//use setTimeout to make sure callback is invoked after all scroll event handlers in stack have executed
setTimeout(callback, 0);
}
});
@smohadjer
smohadjer / scrollByPixel.md
Last active Apr 29, 2016
scroll by pixel using arrow keys
View scrollByPixel.md

Scroll by one pixel via arrow keys up/down for finer control over scrolling. Use to debug scroll related issues.

$(window).on('keydown', function(event) {
	event.preventDefault();
	event.stopPropagation();
	
	var sctop = $(window).scrollTop();
	
	if (event.keyCode === 38) { //up arrow
You can’t perform that action at this time.