Skip to content

Instantly share code, notes, and snippets.

tbusser / component.js
Last active January 27, 2022 21:56
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 / config
Created February 8, 2019 15:10
SSH config for using multiple SSH keys and to prevent OSX from asking for the keyphrase every time
View config
# Default GitHub user
User git
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_github
IdentitiesOnly yes
tbusser /
Created October 9, 2018 08:12 — forked from kevin-smets/
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)
# 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 / dnsmasq OS
Created December 2, 2016 10:15 — forked from ogrrd/dnsmasq OS
Setup dnsmasq on OS X
View dnsmasq OS
tbusser / simple-parallax
Last active July 6, 2016 12:55
Parallax effect, see for an example
View simple-parallax
(function() {
var imgData = [],
windowHeight = window.innerHeight;
lastScrollPosition = 0;
function getOffset(element) {
var rect = element.getBoundingClientRect();
return {
top: + document.body.scrollTop,
tbusser / pad-string.js
Created March 6, 2015 11:48
Pad string
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
tbusser / set-prefixed-property.js
Created February 3, 2015 13:19
Set prefixed property
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) {
tbusser /
Created November 11, 2014 10:17
Tabs vs spaces

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