This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# For when you have a cigar box of SD cards that get dumped onto an external hard drive | |
# https://chat.openai.com/share/7090a9c0-2618-445e-a706-a232cf1d1a29 | |
# | |
import argparse | |
from pydub import AudioSegment | |
from pydub.effects import normalize, compress_dynamic_range | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* store/const.js */ | |
export const state = () => ({ | |
darkMode: false | |
}); | |
export const mutations = { | |
setDarkMode: state => { | |
state.darkMode = true; | |
}, | |
unsetDarkMode: state => { | |
state.darkMode = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import reduce from 'lodash/reduce' | |
import isArray from 'lodash/isArray' | |
const prepareModelForRails = (model) => { | |
if (typeof model !== 'object') { | |
return model | |
} else { | |
if (isArray(model)) { | |
return model.map( m => prepareModelForRails(m) ) | |
} else { | |
return reduce(model, (result, value, key) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EditPersonForm = reduxForm({ | |
form: 'person', | |
touchOnChange: true | |
})(EditPersonForm); | |
import { createStore, combineReducers } from 'redux' | |
import { reducer as formReducer } from 'redux-form' | |
const reducers = { | |
form: formReducer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const renderPhoneNumbers = ({ fields, meta: { touched, error, submitFailed } }) => ( | |
<ul> | |
<li> | |
<button type="button" onClick={() => fields.push({})}>Add Phone Number</button> | |
{(touched || submitFailed) && error && <span>{error}</span>} | |
</li> | |
{fields.map((member, index) => { | |
const field = fields.get(index) | |
if (field && field._destroy) { | |
return false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EditPersonForm extends Component { | |
render() { | |
const { handleSubmit } = this.props | |
return ( | |
<form onSubmit={handleSubmit}> | |
<div> | |
<label htmlFor="first_name">First Name</label> | |
<Field name="first_name" component="input" /> | |
</div> | |
<div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ajax | |
.post( parseHref(this.props) ) | |
.setCsrfToken() | |
.send( updatedPayload(payload,entity) ) | |
.end( (err,response) => { | |
if (err) { | |
return standardError() | |
} | |
this.setDisabled() | |
this.props.callback && this.props.callback() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ajax = require('superagent') | |
require('superagent-rails-csrf')(ajax) | |
export default ajax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've seen links around the web for a list of items and a single 'add to amazon cart' button. | |
I don't know how to do this more easily through an amazon-provided UI, but it seems that you can hack it together through URL params easy enough, like so: | |
https://www.amazon.com/gp/aws/cart/add.html?AssociateTag=your_tag&tag=your_tagQ&ASIN.1=B012NH05UW&Quantity.1=1&ASIN.2=B012M8LXQW&Quantity.2=1 | |
* ASINs are the string after /dp/ in amazon URLs. (amazon.com/dp/string_is_here) | |
* Add as URL params w/ incrementing identifiers and quantity couplets (ASIN.1, Quantity.1, ASIN.2, Quantity.2…) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Use CSS for styling via the awesome styled-components library | |
https://styled-components.com | |
*/ | |
import styled from 'styled-components' | |
const LoadingImage = require('loading-svg/loading-spin.svg') | |
const LoadingComponent = styled(LoadingImage)` |
NewerOlder