Skip to content

Instantly share code, notes, and snippets.

func calculatePushupsToday() {
//get todays date
let calendar = NSCalendar.current
var todaysPushupNumber = 0
for workout in myArray {
//see if any of the entries = today
if calendar.isDateInToday(workout.dateOfSave) == true
{
//add them up.
todaysPushupNumber = todaysPushupNumber + workout.numberOfPushups
@joshdance
joshdance / PlaySounds.swift
Last active March 22, 2018 05:26
Simple example of how to play sounds Swift 4
class ViewController {
var audioPlayer = AVAudioPlayer()
struct Sounds {
static let startupSound: String = "soundname1.wav"
static let downSound: String = "soundname4.mp3"
static let upSound: String = "soundname3.aif"
static let saveSound: String = "soundname2.wav"
}
@joshdance
joshdance / CalcWeek.swift
Created March 23, 2018 07:11
See if a date is this week in Swift
func calcPushupsThisWeek(){
let calendar = Calendar.current
var thisWeeksPushups = 0
let today = Date()
let todayComponents = calendar.dateComponents([.weekOfYear], from: today)
//I have an array of workout objects with dateOfWorkout properties. You can use any date here
for workout in myArray {
let workoutComponents = calendar.dateComponents([.weekOfYear], from: workout.dateOfWorkout)
if todayComponents.weekOfYear == workoutComponents.weekOfYear
Heuristics to tell great AUDIO stories
1. In Interviews, questions to always ask:
1. Tell me about...
2. How did you feel when... (or, how did that feel?)
3. Can you give me an example?
4. (Superlatives) Best, worst. funniest, scariest, hardest, least certain, favorite, etc...
5. (Dig for emotional moments)
2. in reviewing tape, look for three types of moments as good quotes to use:
1. Facts to understand the story (many can be voiced over if they drag on, so don't overlook if they're boring. Flag them.)
const arrowTenPromise = new Promise((resolve, reject) => {
let importantNumber = 11;
if (importantNumber == 10) {
resolve('Success using arrow functions, so we call resolved for the promise.');
} else {
reject('Rejected because important number is not equal to 10');
}
});
arrowTenPromise.then(function(result) {
@joshdance
joshdance / react-checklist-en.md
Created June 29, 2023 18:47 — forked from marko-knoebl/react-checklist-en.md
A checklist for learning React - Fork it and start ticking off topics!

React topics checklist

A checklist for learning React - Fork it and start ticking off topics!

React fundamentals

  • use-cases of React
  • JavaScript basics for React
    • immutability / data management without mutations
  • updating properties of objects
@joshdance
joshdance / gist:715d7e2eb2a1a53c1f460a04cd7f0b8a
Last active November 1, 2023 22:20
Nonsense Site Feedback
Went through the whole site. Overall looks clean but it is still confusing.
I want to know exactly
1. How it works
2. Who it is for. Is it for learning english or learning another language?
Here are my stream of reactions as I scrolled.
1. Don’t just show movies on the homepage. Show me a little of how it will actually work. I discount it because just showing movie footage is lazy. Makes you look cool, but doesn’t show me the value.
2. Don't just show me a list of movie posters. Cool artwork, but how will I learn from the movie?
3. The text “A new learning experience powered by stories.” is fluff. What are you actually saying? New doesn’t equal better. Learning experience = what? Powered by stories = I get that already the first two pages are all about movies.