Skip to content

Instantly share code, notes, and snippets.

View andrewsadowski's full-sized avatar

Andrew Sadowski andrewsadowski

  • DevelopmentNow
  • Portland, Oregon
View GitHub Profile
@andrewsadowski
andrewsadowski / morphagene_directory.py
Created January 8, 2021 01:54 — forked from knandersen/morphagene_directory.py
Takes an input directory containing wave files and splices them together into a morphagene reel
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
USAGE:
morphagene_directory.py -d <inputdirectory> -o <outputfile>'
Script will go through <inputdirectory> and splice all wave-files
together in alphabetic order and place a marker in between.
Requires all wave-files in directory to have the same number of channels and bitrate!
@andrewsadowski
andrewsadowski / morphagene_ableton.py
Created January 8, 2021 01:21 — forked from knandersen/morphagene_ableton.py
Allows you to use Ableton projects and exports as reels for the Make Noise Morphagene eurorack module.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
USAGE:
morphagene_ableton.py -w <inputwavfile> -l <inputlabels> -o <outputfile>'
Instructions in Ableton:
Insert locators as splice markers in your project (Create > Add Locator)
Export Audio/Video with
Sample Rate: 48000 Hz
@andrewsadowski
andrewsadowski / compose.py
Created March 8, 2020 23:45 — forked from TomWhitwell/compose.py
Python script to generate random scores for modular synth
import random
import string
# -*- coding: utf-8 -*-
def randomname(length = 6):
vowels = ['a','e','i','o','u','']
consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
a = random.sample(consonants,length/2)
x = 1
@andrewsadowski
andrewsadowski / slim-redux.js
Created March 10, 2019 01:03 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@andrewsadowski
andrewsadowski / connect.js
Created March 10, 2019 01:03 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@andrewsadowski
andrewsadowski / redux_setup.md
Created February 22, 2019 22:07 — forked from kiok46/redux_setup.md
Redux, store, actions and reducers setup along with explanation.

Redux Setup

Implementation of redux inside any react.js or react-native application,

  • we will create an instance of the redux store.
  • We are going to create a provider tag from react redux library
  • Then render that provider tag passing in the store as a prop, then any child component to this provider tag will have access to this store through the context system inside of react.
  • import { Provider } from ‘react-redux’; // In main.js
  • to create a store create one in a separate folder.
@andrewsadowski
andrewsadowski / checkDep.sh
Created February 7, 2019 20:04
Shell script to check for dependencies
#!/bin/bash
if command -v carthage >/dev/null 2>&1 ;
then
echo "carthage found"
echo "version: $(carthage version)"
else
command -v brew install carthage
fi
@andrewsadowski
andrewsadowski / multi-git-win.md
Created February 7, 2019 00:57 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
  • In the installer, select everything but decide if you want a desktop icon (2nd step)

xml2csv

for LOC in $(ls -d */|tr -d // |cut -d- -f2,3); do grep -r '<string' values-$LOC | tr "\"><" \\t |cut -f3,5 > $LOC.csv ;done

stings2csv

for LOC in $(ls -d */|cut -d. -f1); do grep -r = $LOC.lproj|cut -d\" -f2,4|tr \" \\t>$LOC.csv;done

Common RN errors and fixes

NPM Clean Script:

rm -rf node_modules/ && rm -rf /tmp/metro-bundler-cache-* && watchman watch-del-all

Issue: Android: Unable to load script from assets 'index.android.bundle'

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res