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 / field_collection
Created December 18, 2014 11:35
update field collection without saving entity
http://alexrayu.com/blog/saveupdate-field-collection-without-nodesave
// Get field collection (supposedly containing one image with meta data)
$fc = entity_load('field_collection_item', array($fcid));
// If we were to have multi-value fc's, we weould have a cycle here in place of current()
$fc = current($fc);
// Get meta data. A custom function.
$meta = custom_get_meta_data($fc);
@deepakaryan1988
deepakaryan1988 / drush-MAMP-osx
Last active August 29, 2015 14:13
install drush on osx with MAMP
Ref:- http://cambio.name/personal/content/installing-drush-7x-adding-dependencies-using-composer
Installing Drush 7.x (Adding dependencies using composer)
Submitted by admin on Sat, 07/12/2014 - 14:23
1. Download package in some folder

How To Install Memcache on MAMP 2

  1. Install memcached. I'd suggest using homebrew. brew install memcached
  2. Select your desired version of PHP that you'd like to use in MAMP. This dropdown is located in the PHP tab in MAMP PRO.
  3. Visit the Downloads Page on php.net and download the source code. If your release isn't listed, visit the Releases page.
  4. Extract the source into /Applications/MAMP/bin/php/[php version folder]/include/php.
  5. /Applications/MAMP/bin/php/[php version folder]/include/php/configure
  6. /Applications/MAMP/bin/php/[php version folder]/bin/pecl i memcache.
  7. Add extension=memcache.so to your php.ini
    • MAMP Pro: /Applications/MAMP\ Pro/MAMP\ PRO.app/Contents/Resources/php[your php version].ini

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
@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
@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]
db_change_field('open_sub','mobile','mobile',
array(
'description' => 'Mobile no.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
)
);
@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

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: