Skip to content

Instantly share code, notes, and snippets.

@mnaser
mnaser / my_model.rb
Created July 1, 2011 17:12 — forked from denysonique/my_model.rb
Is there a cleaner/simpler way of doing this?
class MyModel < ActiveRecord::Base
after_initialize :setup_defaults
attr_accessor :foo_bar
def setup_defaults
foo_bar ||= "my default value"
end
end
@mnaser
mnaser / PHP Error
Created December 14, 2012 17:56
WordPress 3.5 Error
Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/wp-content/themes/classipress/includes/admin/admin-options.php on line 843 and defined in /var/www/wp-includes/wp-db.php on line 990
@mnaser
mnaser / gist:4297595
Created December 15, 2012 17:48
Loaded modules
# httpd -M
Loaded Modules:
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
@mnaser
mnaser / install_repos.sh
Created December 16, 2012 19:59
Installing Nginx & Percona repository
rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
@mnaser
mnaser / install_percona.sh
Created December 16, 2012 20:15
This will install the Percona server, start it on system boot, start the service and set a root password and display it.
yum -y install Percona-Server-shared-compat Percona-Server-server-55 expect
chkconfig mysql on
service mysql start
SQL_PW=$(mkpasswd -l 32)
mysqladmin password "$SQL_PW"
echo "Root MySQL Password: $SQL_PW"
@mnaser
mnaser / install_fpm.sh
Created December 16, 2012 20:35
Install php-fpm on CentOS 6
yum --enablerepo=remi install php-fpm php-mysqlnd php-pecl-apc
sed -i s/apache/nginx/ /etc/php-fpm.d/www.conf
chkconfig php-fpm on
service php-fpm start
@mnaser
mnaser / install_nginx.sh
Created December 16, 2012 20:44
Install nginx and configure it with php-fpm
yum -y install nginx
chkconfig nginx on
service nginx start
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}