Skip to content

Instantly share code, notes, and snippets.

View tastycode's full-sized avatar

Sasha Devol tastycode

  • Elsewhere Labs
  • New Orleans, LA
View GitHub Profile
@tastycode
tastycode / toggler.max.js
Created December 4, 2021 09:00
Max 4 Live Patches
autowatch = 1
inlets = 1
var toggles = jsarguments[1]
outlets = toggles
var defaultMessage = typeof(jsarguments[2]) == "undefined" ? "hidden" : jsarguments[2]
var lastvalue
/**
This device takes an int, and sends either "hidden 1" or "hidden 0"
to a dynamic number of outlets. Each outlet can be connected to a UI element
@tastycode
tastycode / waves.js
Created December 3, 2021 16:08
Waves plugin sorter
console.log(JSON.stringify([...document.querySelectorAll(".react-list-page__star-rating-total")].map(el => [parseInt(el.innerText.replace(/[^0-9]/g,'')), el.parentNode.parentNode.querySelector(".react-list-page__product-title").innerText]).sort( (a,b) => b[0]-a[0]), null, 4))
body {
font-family: helvetica, sans-serif;
}
@tastycode
tastycode / index.js
Created May 24, 2020 00:25
Find unused recordings in ableton live sets
// usage "node index.js /path/to/your/project.als"
const path = require('path')
const fs = require('fs')
const Ableton = require('ableton') //https://github.com/CocoFox/ableton
const [_,__,projectPath] = process.argv
const project = new Ableton(projectPath)
const main = async () => {
let final = ""
for (let el in styles ) {
const tagName = el.charAt(0).toUpperCase() + el.slice(1)
const rules = styles[el]
const transformedRules = Object.keys(rules).map( ruleName => {
const cssRule = ruleName.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase();
const convertedStyle = ` ${cssRule}: ${rules[ruleName]};`
return convertedStyle
}).join("\n")
const finalComponent = `const ${tagName} = styled(View)\`
@tastycode
tastycode / sync_to_dropbox.sh
Created March 25, 2020 20:04
Sync MacOSX Catalina Voice Memos to Dropbox
echo 'set +e' > /tmp/script.sh && echo 'mkdir -p "$HOME/Dropbox/Voice Memos"' >> /tmp/script.sh && sqlite3 ~/Library/Application\ Support/com.apple.voicememos/Recordings/CloudRecordings.db "select 'cp -n \"' || zpath || '\" \"$HOME/Dropbox/Voice Memos/' || zcustomlabel || '.m4a\"; touch -t '||strftime('%Y%m%d%H%M', datetime(zdate + strftime('%s','2001-01-01'), 'unixepoch'))||' \"$HOME/Dropbox/Voice Memos/' || zcustomlabel || '.m4a\"' from zcloudrecording;" >> /tmp/script.sh; bash -v /tmp/script.sh
@tastycode
tastycode / autoActionLazyProxy.js
Last active April 20, 2018 18:04
Auto generated action creators
// types.js
const REPORTER_PENDING_REPORT_UPDATE = "[reporter] pending report update"
// actions/reporter.js
const simpleActionCreatorProxy = new Proxy(module.exports, {
get (target, key) {
const actionName = camelToUnderscore(key).toUpperCase()
if (key in target) {
return target[key]
@tastycode
tastycode / lazyAction.js
Last active April 20, 2018 16:55
Dispatching without making an action creator
// types.js
const REPORTER_PENDING_REPORT_UPDATE = "[reporter] pending report update"
// components/PromptHarm.js
import types from 'types'
const PromptHarm = ({dispatch}) => ( <PromptContainer>
<PromptText>Is anyone at risk of immediate harm to themselves or others?</PromptText>
<PromptButtonsContainer>
@tastycode
tastycode / autoActionLazy.jsx
Last active April 20, 2018 16:55
The arduous way
// types.js
const REPORTER_PENDING_REPORT_UPDATE = "[reporter] pending report update"
// actions/reporter.js
export function reporterPendingReportUpdate() {
return { type: types.REPORTER_PENDING_REPORT_UPDATE }
}
// components/PromptHarm.js
import reporterActions from 'actions/reporter'
console.log('i am running the handler binder');
$(function(event) {
console.log('I am running the redirector');
window.location.replace( "https://www.patreon.com/bePatron?c=947861");
});