Skip to content

Instantly share code, notes, and snippets.

@dkandalov
dkandalov / plugin.kts
Last active May 26, 2025 15:38
Mini plugin for IntelliJ to show keyboard shortcuts similar to Presentation Assistant (to be used via LivePlugin)
import com.intellij.ide.ui.UISettings
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.IdeActions
import com.intellij.openapi.actionSystem.ex.AnActionListener
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
@danieldogeanu
danieldogeanu / RenameGitBranch.md
Last active August 3, 2025 16:05
How to rename your Git master branch to main.

To rename your Git master branch to main, you must do the following steps:

  1. Navigate to your repository in the command line and issue the following commands: - git branch -m master main - git push -u origin main

  2. Change your default branch on GitHub by going to your GitHub repository in your browser, and navigate to Settings > Branches and click on the dropdown and switch from master to main and click Update (this will only show if you have two or more branches). The main branch is now your default branch.

  3. Update the tracking of the branch from your command line with the following command: - git branch -u origin/main main

@irvingpop
irvingpop / ssh_key.tf
Last active January 23, 2025 09:07
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"
@dschinkel
dschinkel / tdd-thoughts-by-dave-schinkel.txt
Last active September 27, 2017 20:59
What Does TDD Give Me in terms of a Design Activity?
TDD
---------------------------------------------------------------------------------------------------------------------
Tests and the Red | Green | Blue cycle put pressure on your design all the time as you code. Your design decisions are guided by that pressure.
As Corey Haines once stated: "It's like having a little buddy as you code, helping you along,
pointing things out such as when your design sucks, when you've broken something, etc."
- forces you to only create enough code to make a test pass (you’re keeping lean all the time)
- you won’t be able to write the next test if you have code that’s too coupled
- you’ll know immediately when you’ve broken behavior. This is different than test after.
@robertknight
robertknight / shallowRender.js
Created April 1, 2017 09:15
Shallow rendering implementation for Preact
import { options, render } from 'preact';
import { ATTR_KEY } from 'preact/src/constants';
/**
* Returns the input properties that were passed to an element when it was
* rendered.
*
* See `shallowRender` documentation for usage example.
*/
@alekseykulikov
alekseykulikov / index.md
Last active February 6, 2025 21:20
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@jbelke
jbelke / Mac OSX Setup - Brew
Last active May 2, 2024 05:45
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
@richardscarrott
richardscarrott / !react-enzyme-render-methods.md
Last active September 9, 2020 01:39
react-enzyme - `shallow` vs `mount` vs `render` lifecycle methods

An exploration of the different render methods available in react-enzyme.

@developit
developit / fire-event.js
Last active September 13, 2017 14:05
DOM fireEvent
function fireEvent(element, type) {
let e = document.createEvent('Event');
e.initEvent(type);
element.dispatchEvent(e);
}
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active August 4, 2025 18:48
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH