Skip to content

Instantly share code, notes, and snippets.

View TobiObeck's full-sized avatar

Tobi Obeck TobiObeck

View GitHub Profile
@TobiObeck
TobiObeck / composition_api_1.vue
Last active March 3, 2024 23:09
Vue Composition API
<template>
<h2>My Course Goal</h2>
<p>
{{ goal1 }}
</p>
<!-- Task 1: Output your main course goal with help of the composition API -->
<!-- Don't hardcode it into the template, instead hardcode it into the JS code -->
<h3 v-show="isCourseGoalVisible">OUTPUT COURSE GOAL</h3>
<!-- Task 2: Toggle (show/ hide) the goal with help of the button -->
<button @click="handlers.handleToggleGoalBtn">Toggle Goal</button>
@TobiObeck
TobiObeck / smokeonthewater.py
Last active December 8, 2021 23:14 — forked from ianoxley/smokeonthewater.py
Plays "Smoke on the Water" with Python
# plays smoke on the water with windows sounds
# for linux or mac:
# import os
# duration, freq = 1, 440 # 1 second, 440Hz
# os.system('play -nq -t alsa synth {} sine {}'.format(duration, freq))
# how to play a sound in python: https://stackoverflow.com/a/16573339/6710876
# original by https://gist.github.com/ianoxley/3417873
# minor changes by me: 1.) 200 durations to 300. 2.) shortened sleep(0.5) to sleep(0.1)
  • huge amount of data (e. g. 100 or 1000 characters in text field)
  • very small (only one char)
  • empty string
  • null
  • undefined
  • wrong datatype (string, number, object, array, boolean, date, function...)
  • -0 and +0
@TobiObeck
TobiObeck / 01_Common TypeScript errors and what they mean.md
Last active August 16, 2024 23:56
Common TypeScript errors and what they mean

Array Element implicit any, type has no index signature

Element implicitly has an 'any' type because type 'MyFancyType' has no index signature.",

class MyPerson {
  public name: string;
  public subscriptions: MyFancyType[];
  
  constructor(name: string, subscriptions: MyFancyType){...}
}
@TobiObeck
TobiObeck / 001_js_snippets.md
Last active November 3, 2022 13:08
Cheat Sheets

JavaScript (JS) Snippets

//noticeable console logs
console.log('%c onFormLoad', 'background: #222; color: #bada55');
//iterating over js object
for (const key in obj) {
 let value = obj[key];
var bla = "";
function okcool(){
alert("lel");
}
{"posts":[{"id":1,"title":"hello"}],"profile":{"name":"typicode"},"swag":"overload"}