Skip to content

Instantly share code, notes, and snippets.

View tygerbytes's full-sized avatar
🦖

Ty Walls tygerbytes

🦖
View GitHub Profile
@tygerbytes
tygerbytes / mansplain.zsh
Created August 17, 2021 21:59
Mansplaining whatis wrapper :-)
function mansplain() {
desc=$(whatis $1 2>&1 | head -1 | grep -o -P '\- .*$' | cut -c 3-)
if [[ -z "$desc" ]]; then
echo "Well I've never heard of \"$1\", so it doesn't exist"
else
echo "Well, actually, it's more like $desc"
fi
}
@tygerbytes
tygerbytes / qr.zsh
Created August 17, 2021 17:17
Generate QR code
#!/usr/bin/env zsh
# Make sure we have all the utilities we need
requiredBins=('qrencode' 'feh')
if [[ `uname` == "Darwin" ]]; then
requiredBins+=("pbpaste")
else
requiredBins+=("xclip")
fi
@tygerbytes
tygerbytes / SendSms.cs
Created September 11, 2019 16:32
Azure Function snippet for sending text messages with Twilio
[FunctionName("SendSms")]
public static async Task<IActionResult> Run(
// This is an HTTP trigger accepting POST requests. That's why we are able to invoke it using Postman.
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "tygerbytes/sygnal")] HttpRequest req,
ILogger log,
ExecutionContext context)
{
// The FuncConfig class encapsulates environment-specific settings like those
// TWILIO... environment variables.
var funcConfig = new FuncConfig(context);
@tygerbytes
tygerbytes / body.html
Last active July 14, 2019 16:55
Netlify admin entrypoint
<!-- Add this before </body> -->
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
computed: {
// Do this
missingRaceTime() {
return this.submitted && this.fiveKmRaceTime === '';
},
...
computed: {
// Don't do this
missingRaceTime: () => {
return this.submitted && this.fiveKmRaceTime === '';
},
...
export default {
name: 'RunbyPace',
beforeCreate() {
this.lib = this.$store.state.RunbyLib;
},
...
new Vue({
render: h => h(App),
router,
// Provide the store using the "store" option.
// this will inject the store instance to all child components.
store,
}).$mount('#app');
import Vuex from 'vuex';
...
// The library I want to share amongst the components
import RunbyLib from './runbylib';
...
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
RunbyLib,
<template>
<div id="app" class="container">
...
<router-view>
...
</div>
</template>
...