Skip to content

Instantly share code, notes, and snippets.

@tbusser
tbusser / component.js
Last active Jan 27, 2022
Script files for scaffolding a new Vue component using the `script setup` syntax, and a Storybook story file. The scripts `component.js` and `story.js` are expected in a subfolder named `scaffold-templates`.
View component.js
module.exports = function scaffoldComponent(name) {
return `<script setup lang="ts">
export interface Props {
//Component props go here.
}
/* -------------------------------------------------------------------------- */
const emit = defineEmits<{
// component events go here.
View install-sshd.ps1
# @manojampalam - authored initial script
# @friism - Fixed issue with invalid SDDL on Set-Acl
# @manojampalam - removed ntrights.exe dependency
# @bingbing8 - removed secedit.exe dependency
$scriptpath = $MyInvocation.MyCommand.Path
$scriptdir = Split-Path $scriptpath
$sshdpath = Join-Path $scriptdir "sshd.exe"
$sshagentpath = Join-Path $scriptdir "ssh-agent.exe"
@tbusser
tbusser / config
Created Feb 8, 2019
SSH config for using multiple SSH keys and to prevent OSX from asking for the keyphrase every time
View config
# Default GitHub user
Host github.com
HostName github.com
User git
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_github
IdentitiesOnly yes
Host github.com-rhm
HostName github.com
@tbusser
tbusser / iterm2-solarized.md
Created Oct 9, 2018 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel9k

Powerlevel9k

View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
@tbusser
tbusser / dnsmasq OS X.md
Created Dec 2, 2016 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X
View dnsmasq OS X.md

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

View simple-parallax
(function() {
var imgData = [],
windowHeight = window.innerHeight;
lastScrollPosition = 0;
function getOffset(element) {
var rect = element.getBoundingClientRect();
return {
top: rect.top + document.body.scrollTop,
View pad-string.js
/**
* Pads a string so it will reach the requested number of characters. The
* padding will be added to the left of the original string.
*
* @param {string} value The original string, unpadded.
* @param {Number} length The desired length for the value string. Please
* note that this value should be equal to or exceed
* the unpadded length of the value parameter or
* else the result will be a clipped string.
* @param {string} padChar The character to use to pad the string. When no
View set-prefixed-property.js
var vendors = ['webkit', 'moz', 'ms'];
/**
* This method sets a CSS property. It will set the standard property as
* well as vender prefixed versions of the property.
*
* @param {HTMLElement} element The element whose property to set
* @param {string} property The unprefixed name of the property
* @param {string} value The value to assign to the property
*/
function setPrefixedProperty(element, property, value) {
View tabs-vs-spaces.md

It is my opinion that tabs are better than spaces, especially when working in a team. Why you aks? When using tabs everyone has the ability to indent the code according to their own preference. If your teams decides on using spaces you also need to agree on how many spaces to use for an indent. Do you pick 2 spaces, 4 spaces or something else? Odds are, someone is not going to be happy with the team's decision.

Using tabs gives everyone the freedom to indent the code to their own liking. Most editors have an option to specify how many columns a tab should indent. This allows each team member to pick the setting they're most comfortable with.

To prevent (Git) diff nightmares just follow these simple steps:

  • Always follow the convention used in the project you're working on. If it is a legacy code base and uses 5 spaces for indenting code, use 5 spaces in the code you add or modify;
  • Have your editor (or Git pre-commit hook) strip all trailing whitespace from your files. Trailing whitespace serves no purpo