Skip to content

Instantly share code, notes, and snippets.

typedef MatchValue<T> = T Function();
TValue match<TOptionType, TValue>(
TOptionType selectedOption,
Map<TOptionType, MatchValue<TValue>> branches, {
MatchValue<TValue> defaultValue,
}) {
if (branches.containsKey(selectedOption)) {
return branches[selectedOption]();
}
@glitchedmob
glitchedmob / breakingbadcharacters.json
Created November 6, 2019 17:40
Breaking Bad Characters JSON
[
{
"char_id": 1,
"name": "Walter White",
"birthday": "09-07-1958",
"occupation": [
"High School Chemistry Teacher",
"Meth King Pin"
],
"img": "https://images.amcnetworks.com/amc.com/wp-content/uploads/2015/04/cast_bb_700x1000_walter-white-lg.jpg",
def list_get(arr, index, default=None):
return arr[index] if index < len(arr) else default
import json
from urllib.parse import urljoin
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag

Keybase proof

I hereby claim:

  • I am glitchedmob on github.
  • I am leviz (https://keybase.io/leviz) on keybase.
  • I have a public key ASCtf75K2x7NPrVCaU68dOeabipwiwBRrdUP5xfb8V_2fwo

To claim this, I am signing this object:

@glitchedmob
glitchedmob / audio-convert.ps1
Created December 28, 2016 15:08
A powershell script that uses VLC's audio codecs to convert multiple file in different audio formats to .mp3
function ConvertToMp3([switch] $inputObject, [string] $vlc = 'C:\Program Files\VideoLAN\VLC\vlc.exe') {
process {
Write-Host $_
$codec = 'mp3'
$newFile = $_.FullName.Replace("'", "\'").Replace($_.Extension, ".$codec")
&"$vlc" -I dummy "$_" ":sout=#transcode{acodec=$codec,vcodec=dummy}:standard{access=file,mux=raw,dst=`'$newFile`'}" vlc://quit | out-null
# Uncomment the next line when you're sure everything is working right
#Remove-Item $_.FullName.Replace('[', '`[').Replace(']', '`]')
}
}