Skip to content

Instantly share code, notes, and snippets.

View sanjc's full-sized avatar
๐Ÿ‘พ

Sanj Chakravorty sanjc

๐Ÿ‘พ
View GitHub Profile
@sanjc
sanjc / delete_git_submodule.md
Created April 9, 2020 18:22 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@sanjc
sanjc / delete_git_submodule.md
Created April 9, 2020 18:22 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@sanjc
sanjc / functions.php
Created June 11, 2019 05:01
wordpress - add featured image as required
add_action('save_post', 'wpds_check_thumbnail');
add_action('admin_notices', 'wpds_thumbnail_error');
function wpds_check_thumbnail($post_id) {
// change to any custom post type
if(get_post_type($post_id) != 'post')
return;
if ( !has_post_thumbnail( $post_id ) ) {
@sanjc
sanjc / postgres_queries_and_commands.sql
Created July 30, 2018 20:28 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@sanjc
sanjc / 1_kubernetes_on_macOS.md
Created March 15, 2018 02:37 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@sanjc
sanjc / SCSS.md
Created July 18, 2017 18:33 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

โ‡ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@sanjc
sanjc / SCSS.md
Created July 18, 2017 18:33 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

โ‡ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@sanjc
sanjc / The Technical Interview Cheat Sheet.md
Created June 27, 2017 14:42 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
,userHash,eventId,eventType,page,eventTime2,previousPage,previous_eventId,section
0,80c8e63ad35a1011641ab001e7ff9b25,0,pageLoad,#/basics/accounts/details/assets,2016-03-30 00:00,,,basics
1,80c8e63ad35a1011641ab001e7ff9b25,1,pageLoad,#/basics/expenses,2016-03-30 00:00,#/basics/accounts/details/assets,0.0,basics
2,80c8e63ad35a1011641ab001e7ff9b25,2,pageLoad,#/basics/accounts/details/assets,2016-03-30 00:02,#/basics/expenses,1.0,basics
3,80c8e63ad35a1011641ab001e7ff9b25,3,pageLoad,#/basics/accounts/details/debts,2016-03-30 00:03,#/basics/accounts/details/assets,2.0,basics
4,80c8e63ad35a1011641ab001e7ff9b25,4,pageLoad,#/basics/accounts/details/assets,2016-03-30 00:10,#/basics/accounts/details/debts,3.0,basics
5,80c8e63ad35a1011641ab001e7ff9b25,5,pageLoad,#/basics/expenses,2016-03-30 00:10,#/basics/accounts/details/assets,4.0,basics
6,80c8e63ad35a1011641ab001e7ff9b25,6,pageLoad,#/basics/accounts/details/assets,2016-03-30 00:11,#/basics/expenses,5.0,basics
7,80c8e63ad35a1011641ab001e7ff9b25,7,pageLoad,#/basics/acco