Skip to content

Instantly share code, notes, and snippets.

@tbusser
tbusser / component.js
Last active March 14, 2024 21:40
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`.
module.exports = function scaffoldComponent(name) {
return `<script setup lang="ts">
export interface Props {
//Component props go here.
}
/* -------------------------------------------------------------------------- */
const emit = defineEmits<{
// component events go here.
@tbusser
tbusser / tabs-vs-spaces.md
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
# @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 February 8, 2019 15:10
SSH config for using multiple SSH keys and to prevent OSX from asking for the keyphrase every time
# 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 October 9, 2018 08:12 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

# 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 December 2, 2016 10:15 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

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

@tbusser
tbusser / simple-parallax
Last active July 6, 2016 12:55
Parallax effect, see http://codepen.io/tbusser/pen/QEgmmq for an example
(function() {
var imgData = [],
windowHeight = window.innerHeight;
lastScrollPosition = 0;
function getOffset(element) {
var rect = element.getBoundingClientRect();
return {
top: rect.top + document.body.scrollTop,
@tbusser
tbusser / iterate.js
Last active January 29, 2016 08:57
Iterate over object properties
/**
* Iterates over the properties of an object and calls a callback function when the
* key belongs to the object itself and not to its prototype chain.
*
* The iterate method will iterate over all properties but can be stopped by
* returning true from the callback method.
*
* @param {Object} source The object whose properties should be iterated over
* @param {Function} callback The function to be called for each property defined
* on the source object itself and not its prototype
@tbusser
tbusser / pad-string.js
Created March 6, 2015 11:48
Pad string
/**
* 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