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
@gobinathm
gobinathm / drush-command
Created May 14, 2014 11:30
Listing DRUSH command for User's Easy Reference.
#Generate one time login link.
drush uli <<some-username>>
#(Re)Set the password for the user account with the specified name.
drush user-password <<someuser>> --password="new password"
@gobinathm
gobinathm / php-webscraping.md
Last active August 26, 2015 14:37 — forked from anchetaWern/php-webscraping.md
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}

@gobinathm
gobinathm / git_fork_updated.md
Created October 16, 2015 20:45
Keep For Updated

Keep A GitHub Fork Updated

Overview

Steps to keep a forked Github Repo Up-to-date.

Local Clone

After the forking, clone the repo in to your local system

@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)"
@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 / 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 / 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 / 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 / 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