Skip to content

Instantly share code, notes, and snippets.

View msankhala's full-sized avatar
🎯
Focusing

Mahesh Sankhala msankhala

🎯
Focusing
View GitHub Profile
@msankhala
msankhala / gist:b4acbde558e4f679d8ca
Created December 14, 2015 18:44 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@msankhala
msankhala / .inputrc
Created January 30, 2016 10:50 — forked from gregorynicholas/.inputrc
OSX .inputrc to make terminal way better. and by better i mean i'm naked
"\e[1~": beginning-of-line
"\e[4~": end-of-line
“\e[5~”: history-search-backward
“\e[6~”: history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
@msankhala
msankhala / gist:93a4328f1229756cd3598b453e65a530
Created July 27, 2016 07:35 — forked from cecilemuller/gist:1973201
Programmatically change the active theme in Drupal 7
<?php
/**
* Defines a theme callback function per registered path.
*/
function MODULENAME_menu_alter(&$items) {
$items['node/%node']['theme callback'] = 'MODULENAME_default_node_theme';
$items['node/%node/edit']['theme callback'] = 'MODULENAME_edit_node_theme';
$items['node/%node/edit']['theme arguments'] = array(1);
}
@msankhala
msankhala / drush-turn-off-aggregate-assets.txt
Last active January 2, 2023 08:18 — forked from chrisl8888/drush-turn-off-aggregate-assets.txt
drush disable js/css aggregation
Drupal 7
// To turn on JS Aggregation
drush vset preprocess_js 1 --yes
// To clear all Cache
drush cc all
// To disable JS Aggregation
drush vset preprocess_js 0 --yes
@msankhala
msankhala / default.conf
Created October 26, 2016 10:48 — forked from cbmd/default.conf
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@msankhala
msankhala / what-forces-layout.md
Created November 18, 2016 10:51 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@msankhala
msankhala / drupal-7--fapi_multifield.php
Created November 23, 2016 12:46 — forked from yann-yinn/drupal-7--fapi_multifield.php
Creat multiple field (add more buttons) for form api elements
<?php
/**
* @file
* Re-usable stuff.
*
* @FIXME multifield function seems not to work in included several times in the same page.
*/
/**
* Implements hook_theme()
<?php
/**
* Embed a view with a title. Pretty much copying the views_embed_view() but
* adding the ability to display title.
*
* @param string $name The name of the view to embed.
* @param string $display_id The display id to embed. If unsure, use 'default',
* as it will always be valid. But things like 'page'
* or 'block' should work here.
* @param string $title_tag The html header tag (h1, h2, h3, etc..).
<?php
/**
* @file
* Sets up a custom filter that enables custom shortcodes.
*/
/**
* Implementation of hook_filter_info()
*/
function custom_shortcodes_filter_info() {
@msankhala
msankhala / drupal-hooks-by-implementation
Created February 3, 2017 06:13 — forked from webchick/drupal-hooks-by-implementation
A list of hooks in all* Drupal contrib modules (6.x and 7.x), in descending order of how often they're implemented. (Consolidated a few that were renamed between 6 and 7) * Within a rounding error. :P
Array
(
[hook_menu] => 6744
[hook_uninstall] => 4742
[hook_perm(ission)] => 4012
[hook_install] => 3751
[hook_theme] => 3525
[hook_schema] => 3003
[hook_help] => 2465
[hook_form_alter] => 2273