Skip to content

Instantly share code, notes, and snippets.

Josh Justice CodingItWrong

View GitHub Profile
@CodingItWrong
CodingItWrong / async-scope.js
Last active Apr 29, 2020
Async JS Functions' Shared scope
View async-scope.js
// option 1
() => {
return call1().then(response1 => {
return call2(response1.field);
}).then(response2 => {
console.log({ response1, response2 }); // response1 not in scope
});
};
@CodingItWrong
CodingItWrong / octane.md
Created Oct 11, 2019
Octane Observations
View octane.md

“What parts of this app are the most awkward or thorny?”

  • Requiring parens after the decorators for Ember Data attr/hasMany is inconsistent with other Ember decorators; will be nice when those are no longer needed
  • I forget why I’m using .set() and pushObject() on Ember Data models. They might not be required, but if it is, that’s not ideal because inconsistent—it’ll be good when we can use assignment and push() everywhere.
  • I ran into an issue where I tried to have a computed property based on an Ember Data ID, but its ID is not tracked, so I needed to use .get(). This inconsistency was unintuitive. https://github.com/emberjs/data/issues/6393
  • I’m always loading core data in routes but saving changes in components. Routes have the store available automatically but components need it injected.
  • Having to return RSVP.hash for multiple model calls rather than Promise.all is not ideal; it’d be nice to be on the JS standard. (Not 100% sure if I need to use RSVP.hash, but at some point I understood t
@CodingItWrong
CodingItWrong / questions.md
Created Aug 30, 2019
Copy Paste Repeat questions
View questions.md

Hey y’all, I have a couple of questions in response to Episode 31, “You can only code so fast.” Maybe they’d make interesting followup discussion.

The question addressed is “what comes after senior?” You mentioned at the end of the episode that you don’t necessarily need to be looking to move beyond senior, but the gist of the convo implied that most devs most of the time would. I want to dig into that a bit more:

  • You mentioned the idea "I can't get paid any more to keep doing what I'm doing right now." I’m privileged to be paid pretty well. Am I a crazy outlier that I don't think I need more money than I'm making right now?
  • Do you think that most developers will always want to continue to be challenged in new ways? Do most developers never reach a point where they say "what I'm doing here is great, I want to continue doing what I'm doing in different arenas and for different people?"

As far as when people do want a new challenge, the two categories you mostly discussed were deeper IC computer-

View vue-apollo-update.js
// see https://vue-apollo.netlify.com/guide/apollo/mutations.html
{
addTag() {
// We save the user input in case of an error
const newTag = this.newTag
// We clear it early to give the UI a snappy feel
this.newTag = ''
// Call to the graphql mutation
this.$apollo.mutate({
// Query
View programming-burgers.md

Inspired by this exchange:

@rickhanlonii: My phone autocorrects in-n-out to --no-config it's probably okay

@CodingItWrong: There are a lot of configuration-heavy burger places these days

  • React: You just get the hamburger patty because we want it to be edible by the widest possible variety of people. How can we know in advance how you want to eat it?
  • Preact: less than three calories and just as tasty as React to most people's tastebuds.
  • Vue: we include the pieces that most burgers will need: the patty, the cheese, and the bun. Everyone can add the condiments they already like.
  • Ember: the burger will be more delicious if all of us focus on improving one recipe.
View NewMessageForm.js
import React, { Component } from 'react';
import {
TextInput,
View,
} from 'react-native';
export default class NewMessageForm extends Component {
render() {
return (
<View>
View App.js
import React, { Component } from 'react';
import {
View,
} from 'react-native';
export default class App extends Component {
render() {
return (
<View>
</View>
View package.json.diff
{
...
"detox": {
- "test-runner": "jest"
+ "test-runner": "jest",
+ "configurations": {
+ "ios.sim": {
+ "binaryPath": "bin/Exponent.app",
+ "type": "ios.simulator",
+ "name": "iPhone 8"
View firstTest.spec.js.diff
+const { reloadApp } = require('detox-expo-helpers');
+
describe('Example', () => {
beforeEach(async () => {
- await device.reloadReactNative();
+ await reloadApp();
});
View package.json.diff
"android": "expo start --android",
"ios": "expo start --ios",
+ "test": "node_modules/.bin/jest test/**/*.spec.js",
"eject": "expo eject"
},
...
"jest-expo": "^31.0.0"
},
+ "jest": {
+ "preset": "jest-expo"
You can’t perform that action at this time.