Skip to content

Instantly share code, notes, and snippets.

View miteshmap's full-sized avatar
👨‍💻
Working from home

Mitesh Patel miteshmap

👨‍💻
Working from home
View GitHub Profile
@miteshmap
miteshmap / Readme
Created February 2, 2014 14:44
Omega 4 Theme installation.
Omega 4 Subtheme creation with SAss compile. (Must have ruby / compass / sass installed already)
create sub theme using Drush
drush help —filter=omega
this will show you command owiz (Omega-wizard.)
execute: drush owiz
And follow the steps. this will create a sub theme.
Now, to make css ,
@miteshmap
miteshmap / foo.php
Created January 3, 2014 08:45
Get user city /state/ country information from IP Address.
<?php
function getInfo_of_ip($ip){
$url = "http://api.geoio.com/q.php?key=fC3tzSLwbhXWXnTS&qt=geoip&d=comma&q=".$ip;
$timeout = 5;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$d = curl_exec($ch);
@miteshmap
miteshmap / gist:7914634
Created December 11, 2013 17:21
FACEBOOK SHARE BUTTON
$fb_url = "https://www.facebook.com/sharer.php?
&p[url]=http://bit.ly/myelection
&p[images][0]=http://election.gv.my/assets/vote.png
&p[title]=My customized title
&p[summary]=My customized summary";
@miteshmap
miteshmap / foo.module
Last active December 29, 2015 12:49
Implements hook_rule_condition_info - add condition to rules.
<?php
/**
* Implements hook_rules_condition_info()
*/
function foo_rules_condition_info() {
return array(
'foo_check' => array(
'label' => t('Check foo condition'),
'parameter' => array(
@miteshmap
miteshmap / foo.module
Last active December 29, 2015 02:09
Add custom View Mode for entity
<?php
/**
* Implements hook_entity_info_alter().
*/
function foo_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['another_teaser'] = array(
'label' => t('Another teaser'),
'custom settings' => TRUE,
);