Skip to content

Instantly share code, notes, and snippets.

View bhashkarsharma's full-sized avatar

Bhashkar Sharma bhashkarsharma

View GitHub Profile
@bhashkarsharma
bhashkarsharma / facebook_post_comments.py
Last active August 29, 2015 14:06
Reply to Facebook birthday posts
# This script will go through your facebook wall,
# pick the posts within 3 days of your birthday
# and like all of them, in addition, allowing you
# to respond to the wishes with a comment.
# You will be prompted to comment each time.
# If you just hit 'Enter', it will submit the default comment.
# this needs facepy to be installed
# run 'pip install facepy'
@bhashkarsharma
bhashkarsharma / count_ng_watchers.js
Created August 2, 2016 13:03
Count the number of angular watchers
(function () {
var elements = document.getElementsByClassName('ng-scope');
var watches = [];
var visited_ids = {};
for (var i=0; i < elements.length; i++) {
var scope = angular.element(elements[i]).scope();
if (scope.$id in visited_ids)
continue;
visited_ids[scope.$id] = true;
watches.push.apply(watches, scope.$$watchers);
escape ^xX
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n*%f %t%{= kG}%+Lw%< %{= kG}%-=%D %m/%d/%y | %C:%s %A | %1`%{-}'
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
name,ring,quadrant,isNew,description
Design system,Adopt,Tools,TRUE,"<p>As application development becomes increasingly dynamic and complex, it's a challenge to deliver accessible and usable products with consistent style. This is particularly true in larger organizations with multiple teams working on different products. <strong>Design systems</strong> define a collection of design patterns, component libraries and good design and engineering practices that ensure consistent digital products. Built on the corporate style guides of the past, design systems offer shared libraries and documents that are easy to find and use. Generally, guidance is written down as code and kept under version control so that the guide is less ambiguous and easier to maintain than simple documents. Design systems have become a standard approach when working across teams and disciplines in product development because they allow teams to focus. They can address strategic challenges around the product itself without reinventing the w
@bhashkarsharma
bhashkarsharma / useWhyDidComponentUpdate.ts
Created September 3, 2023 06:25
React hook to track changes across render cycles. One of the most useful utilities for debugging perf or rendering weirdness.
import { useEffect, useRef } from 'react';
export type Props = Record<string, any>;
export default function useWhyDidComponentUpdate(componentName: string, props: Props) {
const prevProps = useRef<Props>({});
useEffect(() => {
if (prevProps.current) {
const allKeys = Object.keys({ ...prevProps.current, ...props });
@bhashkarsharma
bhashkarsharma / useComponentDebug.js
Created January 6, 2024 11:43
Debug React component rendering with this JS hook (includes render count logging)
import { useEffect, useRef } from 'react';
const PREFIX = '[useComponentDebug]';
export default function useComponentDebug(componentName, props) {
const prevProps = useRef({});
console.count(`${PREFIX} ${componentName} render`);
useEffect(() => {