Skip to content

Instantly share code, notes, and snippets.

@chrisdiana
chrisdiana / InstallChrome.ps1
Last active Jun 18, 2021
Install Chrome on Windows
View InstallChrome.ps1
$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor = "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)
@chrisdiana
chrisdiana / my-counter.js
Created May 24, 2021
Web Component Example
View my-counter.js
const template = document.createElement('template');
template.innerHTML = `
<style>
* {
font-size: 200%;
}
span {
width: 4rem;
display: inline-block;
View foreach-async.js
const urls = ['foo.bar1', 'foo.bar2'];
function makeRequest(url) {
return new Promise((resolve, reject) => {
fetch(url)
.then(resolve)
.catch(reject);
});
}
@chrisdiana
chrisdiana / index.html
Last active Aug 21, 2021
Simple Vue / Vuetify Template
View index.html
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
</head>
<body>
<div id="app">
@chrisdiana
chrisdiana / index.html
Created Apr 10, 2021
HTML5 Boilerplate
View index.html
<!DOCTYPE html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="">
@chrisdiana
chrisdiana / vuetify.md
Created Mar 5, 2021
Vuetify Cheatsheet
View vuetify.md

Center vertically and horizontally in Vuetify

   <v-container fill-height fluid>
          <v-row align="center"
              justify="center">
          <v-img
            :src="require('../assets/logo.png')"
            center
            max-width="200"
View simple-vue-veutify-template.html
<!DOCTYPE html>
<html>
<head>
<title>Simple Vue Template</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
</head>
<body>
<v-app>
View makefile-cheatsheet.md

Makefile Cheatsheet

uglify = $(uglify)        # lazy assignment
compressor := $(uglify)   # immediate assignment
prefix ?= /usr/local      # safe assignment
hello += world            # append
View flexbox-cheatsheet.md

Display: Flex

Makes container use flex

#container {  display: flex;}

Flex Direction

column, row-reverse and column-reverse

@chrisdiana
chrisdiana / s3_rename.sh
Created Jan 21, 2021
S3 Mass Rename Files
View s3_rename.sh
# move all txt to tsv in directory
for file in $(aws s3 ls s3://bucket-name/path/ | awk '{print $4}'); do
if [[ $file == *.txt ]]; then
filename="${f%.*}"
aws s3 mv s3://bucket-name/path/$file s3://bucket-name/path/$filename.tsv
fi
done