Skip to content

Instantly share code, notes, and snippets.

View gobinathm's full-sized avatar
💻
I may be slow to respond.

Gobinath Mallaiyan gobinathm

💻
I may be slow to respond.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am gobinathm on github.
  • I am gobinathm (https://keybase.io/gobinathm) on keybase.
  • I have a public key ASCHO0X_kXqcI0TOyjmGZy-HrHwDi3yINENYEze3HFLHPQo

To claim this, I am signing this object:

@gobinathm
gobinathm / mysql_password_retrival.md
Created March 9, 2017 00:48
Retrive Lost MySql Root Password in Mac / Linux
  • Stop MySQL:
sudo /usr/local/mysql/support-files/mysql.server stop
  • Next Step would be to start it in safe mode:
sudo mysqld_safe --skip-grant-tables
@gobinathm
gobinathm / shallow_update_git.md
Created March 6, 2017 18:24
Fix for Remote rejected shallow update not allowed after changing Git remote URL

Some Time there is a shallow update not allowed issue in your cloned GIT repo.

This means that you have to unshallow your repository. To do so you will need to add your old remote again.

git remote add origin <path-to-old-remote> After that we use git fetch to fetch the remaining history from the old remote (as suggested in this answer).

git fetch --unshallow origin And now you should be able to push into your new remote repository.

@gobinathm
gobinathm / efq_debug.md
Created March 3, 2017 19:59
Debugging Entity Field Query by Displaying the Query as a string
function MYMODULE_query_alter($query) {
  if ($query->hasTag('entitydebug')) {
    dpm((string)$query);
  }
}

###Add the TAG in EntityFieldQuery

@gobinathm
gobinathm / janrain_extra.js
Created February 13, 2017 16:51
Custom Validation for Janrain form in a Drupal site using jquery-validate plugin
/**
* @file
* JavaScript for Custom Janrain Requirements.
*/
(function($) {
Drupal.behaviors.Janrain = {
attach: function(context, settings) {
// SetInterval to attach to janrain handlers.
// Use intval incase janrain object not yet loaded.
@gobinathm
gobinathm / permission_fix.sh
Created December 15, 2016 15:45
Shell Script to Fix Home Folder permissions
cd $HOME
{ sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; \
sudo chown -R $UID:staff ~ $_ ; \
sudo chmod -R -N ~ $_ ; \
sudo chmod -R 755 ~ $_ ; \
sudo chmod 700 Desktop Documents Downloads Dropbox Library Movies Music Pictures Sites $_ ; \
sudo chmod 777 Public ; \
sudo chmod 733 Public/Drop\ Box ; \
} 2> /dev/null
@gobinathm
gobinathm / entity-metdata-wrapper-examples.md
Created November 2, 2016 06:04 — forked from cesarmiquel/entity-metdata-wrapper-examples.md
Entity Metadata Wrapper API examples

Entidades en Drupal 7

En Drupal 7 se 'mergearon' los usuarios, nodos y taxonomías en una entidad. Las entidades pueden tener campos adicionales a los que ya tenían. Adicionalmente, cada campo puede estar traducido y, por lo tanto, tener distintos valores dependiendo del idioma. En general es mejor acceder a los valores de los campos via APIs en lugar de acceder directamente al campo. Listamos algunas de las funciones más útiles y recomendadas para utilizar:

  • entity_load() - permite cargar una entidad. Los tipos de las entidades pueden ser 'node', 'user', etc. Ver: entity_load()
  • field_get_items() - devuelve, dada una entidad y el nombre de un campo la lista de valores que contiene el campo. Ver: field_get_values()
  • field_view_value() - devuelve un array rendereable con el valor. Para obtener HTML hacer drupal_rend
@gobinathm
gobinathm / Ruby Notepad Bookmarklet
Created March 31, 2016 16:52 — forked from jakeonrails/Ruby Notepad Bookmarklet
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@gobinathm
gobinathm / osx_install.sh
Created March 26, 2016 03:37 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"