Skip to content

Instantly share code, notes, and snippets.

View msankhala's full-sized avatar
🎯
Focusing

Mahesh Sankhala msankhala

🎯
Focusing
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active October 7, 2026 00:48
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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@jpalala
jpalala / how-to-setup-mac-elasticsearch.md
Created September 11, 2015 08:28
setting up elasticsearch on your mac with brew

Install va homebrew

If you don't have homebrew installed - get homebrew here

Then run: brew install elasticsearch

Configuration

Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.

@xero
xero / irc.md
Last active September 27, 2026 09:17
irc cheat sheet
@carols10cents
carols10cents / javascript-to-rust-cheat-sheet.md
Last active September 16, 2026 15:41
JavaScript to Rust Cheat Sheet

JavaScript to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in JavaScript and Rust so that programmers most comfortable with JavaScript can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

JavaScript:

@apollolm
apollolm / nginx-ssl-config
Last active January 12, 2023 14:47
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@hay
hay / cheatsheet.md
Last active January 6, 2021 15:19
Hay's dev cheatsheet
@msankhala
msankhala / combine exposed filter.php
Created August 3, 2014 07:00
Chose the exposed filter from a list of dropdown exposed filter and search within that selected filter with the search term entered in the same textfield. https://www.dropbox.com/s/jgenr05lo8r3173/Voila_Capture%202014-08-01_11-01-15_pm.png 1) Create a view with title and body field. 2) Create two filter with title and body with operator 'Contain…
<?php
/**
* Implements hook_FORM_ID_alter().
*/
function custom_form_views_exposed_form_alter(&$form, &$form_state, $form_id){
if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'VIEWS_NAME') {
// Unset the title and body filter info so that it doesn't print any label.
unset($form['#info']['filter-title']);
unset($form['#info']['filter-body_value']);
// Set the #printed = TRUE on title and body render element to escape them from being print.
@jmolivas
jmolivas / DefaultController.php
Last active August 20, 2022 18:57
Drupal 8 example: How to render a Twig template and load a CSS file from a Controller
<?php
namespace Drupal\acme\Controller;
use Drupal\Core\Controller\ControllerBase;
class DefaultController extends ControllerBase
{
/**
@thebouv
thebouv / ducks.sh
Last active February 19, 2026 16:35
ducks: linux command for the 10 largest files in current directory
du -cks * | sort -rn | head -11
# Usually set this up in my bash profile as an alias:
# alias ducks='du -cks * | sort -rn | head -11'
# Because it is fun to type ducks on the command line. :)
class CsvFileIterator implements \Iterator{
protected $in;
protected $fp;
protected $index;
protected $current;
public function __construct($in, $options = array()) {
$this->in = $in;
$this->options = array_merge(array(
'column_separator' => ','
), $options);