Skip to content

Instantly share code, notes, and snippets.

@jgusta
jgusta / gist:8787983
Last active August 29, 2015 13:55
Mango Quinoa Black Bean Salad
2 cups cooked quinoa, cooked in vegetable or chicken broth, at room temperature or chilled
1 (15-ounce) can black beans, drained and rinsed
2 medium mangos, peeled and diced
2 red bell pepper, diced
4 green onions, white and green parts thinly sliced
1/2 cup chopped fresh cilantro
4 tablespoon red wine vinegar
3 tablespoons extra virgin olive oil
1-2 tablespoons fresh lime juice
1/2 teaspoon kosher salt
@jgusta
jgusta / clearCacheFiles.php
Created April 25, 2017 17:44
The removed clearCacheFiles() function
function clearCacheFiles($cacheLocation) {
if (is_string($cacheLocation)) {
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($cacheLocation), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
if ($file->isFile()) {
@unlink($file->getPathname());
}
}
}
}
@jgusta
jgusta / dump_walk.php
Created November 25, 2019 06:42
A function that returns a big string version of var_dump or print_r except it descends into private props and shows things in as compact manner as possible.
<?php
if (!function_exists('dump_walk')) {
/**
* This function is like print_r($node, true) but cleaner
* @param $node
* @param string $indent_string
* @param int $depth
* @param null $parentType
* @return string
*/
/*
source: https://codeburst.io/alternative-to-javascripts-switch-statement-with-a-functional-twist-3f572787ba1c
the match() function is an alternative to a switch statement.
Benefits are:
The chain is an expression, unlike a switch statement.
Each case has its own scope.
The default case (.otherwise()) is mandatory.
result = match(2)
@jgusta
jgusta / machine.js
Last active March 15, 2020 23:57
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jgusta
jgusta / machine.js
Created May 10, 2020 20:17
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jgusta
jgusta / twitchCom.fish
Last active September 2, 2021 14:26
Download all Twitch VOD Comments and the Avatars - Aug 30, 2021
function twitchCom
# requires jq, fish shell, wget and curl
set videoId "$argv[1]"
set clientId kimne78kx3ncx6brgo4mv6wki5h1ko
set deviceId p7vCimC0LlUFnAlNYCQVMuztj9DhSZa5
set jsonPart 0
set dirPrefix "$videoId-comments"
set partFormatted (string pad -c 0 -w 3 "$jsonPart")
set avatars "$dirPrefix/avatars"
set raw "$dirPrefix/raw"
{"ass":[
[
"2010-07-12",
"7911.39"
],
[
"2010-07-13",
"14810.13"
],
[
@jgusta
jgusta / scanroom.js
Last active August 13, 2022 11:37
Run in console of Discord browser app to get a list of all users in the room.
(function () {
return new Promise(async (final) => {
const list = await new Promise((res) => {
let l = document.querySelectorAll("[aria-label=Members]")[0]
.parentElement;
l.scrollTo({ top: 0, left: 0, behavior: "instant" });
setTimeout(() => res(l), 500);
});
let names = [];
const height = list.scrollHeight - window.innerHeight;
@jgusta
jgusta / svn2gitmac.md
Created October 10, 2022 02:05
Getting svn2git to work on Mac 8/2020

Getting svn2git to work on Mac 8/2020

** originally posted here: nirvdrum/svn2git#295 ** ** Note this guide is old, but svn2git still hasn't been updated. **

Hello my fellow SVN refugees. We are bailing from Cloudforge as they are shutting down their SVN services. Here's how I got svn2git to work on my Mac locally. (Mojave 10.14.6). This should help with (#292) and (#283)

  • We're lucky to have a standard svn layout. I'm afraid I can't help with non-standard.
  • Using bash and iterm2.
  • Make sure your password doesn't have any dollar signs or other special bash characters like a space or backslash. If you have a dollar sign in your password you are going to have a bad time. I don't know how to get around it, its easier to just change your password.