Skip to content

Instantly share code, notes, and snippets.

View deepakaryan1988's full-sized avatar
🎯
Focusing

Deepak Kumar deepakaryan1988

🎯
Focusing
View GitHub Profile
@deepakaryan1988
deepakaryan1988 / wp-live-local.txt
Last active November 27, 2015 15:26
Dumping WP site from live to local
UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://localhost/test-site') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com', 'http://localhost/test-site');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.example.com','http://localhost/test-site');
@deepakaryan1988
deepakaryan1988 / date_field
Created November 18, 2015 15:49
Creating date field in custom form
http://drupal.stackexchange.com/questions/127729/form-api-fomatting-the-date-select-lists
$form['scheduled_for'] = array(
'#type' => 'date_select',
'#title' => t('Scheduled for'),
'#date_label_position' => 'within',
'#date_format' => 'd-F-Y',
'#date_increment' => 15,
'#date_year_range' => '-0:+1',
@deepakaryan1988
deepakaryan1988 / related_content_block
Last active November 6, 2015 14:12
related content block

Install MongoDB with Homebrew

brew install mongodb
mkdir -p /data/db

Set permissions for the data directory

Ensure that user account running mongod has correct permissions for the directory:

@deepakaryan1988
deepakaryan1988 / page-load-time-drush
Created July 8, 2015 09:55
Page load time via drush
time drush php-eval '
 $path="node/10"; menu_set_active_item($path); menu_execute_active_handler($path, TRUE);' > /dev/null
db_change_field('open_sub','mobile','mobile',
array(
'description' => 'Mobile no.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
)
);
@deepakaryan1988
deepakaryan1988 / singlepage-https
Created March 2, 2015 17:21
Redirect single page to https
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^quote-flow https://%{HTTP_HOST}/quote-flow [R=301,L]
@deepakaryan1988
deepakaryan1988 / mongodb setup
Created February 25, 2015 17:48
Mongo Setup ubuntu
For mongo extension
1.pecl install mongo
3.apt-get install php5-dev php5-cli php-pear
3.vim /etc/php5/apache2/php.ini
extension=mongo.so

sign up for a new relic account first and you'd get the license key on your account page.

sudo sh -c 'echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list'

sudo wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -

sudo apt-get update

sudo apt-get install newrelic-sysmond

sign up for a new relic account first and you'd get the license key on your account page.

sudo sh -c 'echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list'

sudo wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -

sudo apt-get update

sudo apt-get install newrelic-sysmond