Skip to content

Instantly share code, notes, and snippets.

View JoshuaTheMiller's full-sized avatar
🎯
Focusing

Joshua Miller JoshuaTheMiller

🎯
Focusing
View GitHub Profile
@JoshuaTheMiller
JoshuaTheMiller / ListViewVsListBox.xaml
Created March 6, 2017 19:42
A comment on an MSDN Blog article - ListBox
<!--I believe the control that should actually be used is a ListBox. While ListView does indeed derive from ListBox, and the ItemTemplate property is left exposed, to actually change how the data is presented you should have changed "ListView.View" (finding out why requires some more reading on ListViews). The problem with this is that ListView.View is of type ViewBase and the only concrete implementation of ViewBase that ships with WPF is "GridView". Creating a list that looks like your picture, with a ListView, would require something like this: -->
<ListView ItemsSource="{Binding MyStringList}">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="GridViewColumnHeader">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</GridView.ColumnHeaderContainerStyle>
@JoshuaTheMiller
JoshuaTheMiller / docker_cleanup.ps1
Last active December 4, 2017 23:54
A simple PowerShell cleanup script for a **development** environment that uses Docker. This just force removes things.
$shouldDeleteImages = Read-Host -Prompt 'Do you wish to delete all images? Default is no. (y/n)'
$listOfContainers = (docker ps -a -q)
if($listOfContainers)
{
"There are containers, they shall now be removed."
docker rm $($listOfContainers) --force
@JoshuaTheMiller
JoshuaTheMiller / .travis.yml
Created January 8, 2018 21:51
A Travis-CI config file for deploying an Angular app to a GitHub repo
language: node_js
node_js:
- "8.9.0"
branches:
only:
- master
install:
- npm install -g @angular/cli
@JoshuaTheMiller
JoshuaTheMiller / TravisBuildKicker.sh
Last active January 11, 2018 19:37
A shell script for kicking off Travis-CI builds. Requires 3 environment vars to be set.
#!/bin/bash
# Requires 3 env vars to be set:
# ACCESS_TOKEN - your Travis-CI auth token. https://medium.com/@aflyingcaveman/retrieving-your-travis-ci-api-access-token-bc706b2b625a
# REPO_TO_KICK - the name of the repo to kick.
# OWNER_OF_REPO - your repo owner name.
body='{
"request":{
"branch":"master",
@JoshuaTheMiller
JoshuaTheMiller / UbuntuRVMInstall.sh
Last active March 8, 2018 09:00
Ubuntu RVM install script
sudo apt-get update -y; \
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB; \
sudo apt-get install software-properties-common -y; \
sudo apt-add-repository -y ppa:rael-gc/rvm; \
sudo apt-get update -y; \
sudo apt-get install rvm -y; \
rvm install "ruby-2.4.3"; \
rvm use "ruby-2.4.3";
@JoshuaTheMiller
JoshuaTheMiller / AddBashToContextMenu.reg
Created January 15, 2018 23:43
Adds the ability to open the current folder in a Bash Shell via the Windows 10 context menu. Use at your own risk as this modifies the registry.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]
@="Open with Bash"
"Icon"="%USERPROFILE%\\AppData\\Local\\lxss\\bash.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="\"C:\\Windows\\System32\\bash.exe\""
@JoshuaTheMiller
JoshuaTheMiller / AddAdmnCmdToContextMenu.reg
Created February 22, 2018 02:58
Adds the ability to open the current folder in an Administrative Command Prompt via the Windows 10 context menu. Use at your own risk as this modifies the registry.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedCmd]
@="Open with Administrator Command Prompt"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedCmd\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenElevatedCmd]
@JoshuaTheMiller
JoshuaTheMiller / index.js
Created May 10, 2018 03:18
The Lambda for the DailyGoodJob Flash Briefing tutorial.
// Check out the walkthrough at: https://medium.com/@aflyingcaveman
const phrases = [
"You're doing great!",
"You're awesome!",
"Good job at doing what you do!"
];
exports.handler = (event, context, callback) => {
const todaysDate = getTodayAsDateWithNoTime();
# As always, make sure you know what a script is doing before blindly trusting someone's Gist :)
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
refreshenv
choco install boxstarter -y
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8080);
console.log('Server running at *:8080/');