Skip to content

Instantly share code, notes, and snippets.

View scawp's full-sized avatar

scawp

View GitHub Profile
@scawp
scawp / BasicAudioModifier.cs
Created February 4, 2022 08:27
A Basic Audio Modifier for random pitch/volume for an AudioClip #Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BasicAudioModifier : MonoBehaviour {
public List<AudioClip> audioClips = new List<AudioClip>();
[Header("Controls")]
public bool mute = false;
@scawp
scawp / UserScript.js
Last active August 3, 2023 20:44
A UserScript to see which Github forks are ahead and other info
// ==UserScript==
// @name Github is Fork Ahead
// @version 0.1
// @description Shows how far ahead/behind a fork is from upstream when viewing fork page on github
// @match https://github.com/*/*/network/members
// ==/UserScript==
async function fetchLastCommit(partial_url) {
const response = await fetch('https://api.github.com/repos/' + partial_url + '/commits?page=1&per_page=1')
const commitJson = await response.json();
@scawp
scawp / build.sh
Created November 22, 2021 13:48
A simple Love2D build script with ability to ignore top level files and directories
#!/bin/bash
rm ./tools/build/build.love
find * -maxdepth 0 | grep -vFf ./tools/build/ignore.txt | zip -r ./tools/build/build.love -@
--Ended up using string.gmatch in my project instead, adding here for reference
--License MIT or original?
function string_explode(str, div, limit) --extention of https://love2d.org/wiki/String_exploding
assert(type(str) == "string" and type(div) == "string", "invalid arguments")
limit = limit or 0 -- 0/1/nil = no limit, n = n or all
local o = {}
while true do
local pos1,pos2 = str:find(div)
if not pos1 then
o[#o+1] = str