Skip to content

Instantly share code, notes, and snippets.

@jinnkhan88
jinnkhan88 / [iOS ipsw.download]
Last active July 1, 2022 07:37
[iOS ipsw.download Progress] If you are restoring your iphone and you don't see a download progress. Run this in terminal to see the progress.
while true
do
clear
ls -lhrt ~/Library/iTunes/iPhone\ Software\ Updates
sleep 1
const childMachine = Machine({
id: 'child',
initial: 'step1',
states: {
step1: {
on: { STEP: 'step2' },
},
step2: {
on: { STEP: 'step3' },
},
const echoCallbackHandler = (context, event) => (callback, onEvent) => {
onEvent(e => {
if (e.type === 'HEAR') {
callback('ECHO')
}
})
}
const echoMachine = Machine({
id: 'echo',
const fetchAnimals = ()=>{
return fetch('https://www.reddit.com/r/aww.json')
.then(res => res.json())
.then(data => data.data.children.map(child => child.data))
}
const cuteAnimals = Machine({
id:'cuteAnimals',
initial:'idle',
context:{
const lightMachine = Machine({
id:'trafficLight',
initial:'red',
context:{
rushHourMultiplier:1
},
on:{
INC_RUSH_HOUR:{
actions:['incRushHour']
const tryAgainMachine = Machine({
id:'tryTryagain',
initial:'idle',
context:{
tries:0
},
states:{
idle:{
on:{ TRY:'trying'}
},
@jinnkhan88
jinnkhan88 / machine.js
Last active June 6, 2021 18:52
Generated by XState Viz: https://xstate.js.org/viz
const spaceHeaterMachine = Machine({
id: 'spaceHeater',
initial: 'poweredOff',
states: {
poweredOff: {
on: { TOGGLE_POWER: 'poweredOn.hist' }
},
poweredOn: {
on: { TOGGLE_POWER: 'poweredOff' },
type:'parallel',
const spaceHeader = Machine({
id:'spaceHeader',
initial:'poweredOff',
states:{
poweredOff:{
on:{
TOOGLE_POWER:'poweredOn'
}
},
poweredOn:{
const doorMachine = Machine({
id:'door',
initial:'locked',
states:{
locked:{
id:'locked',
on:{
unlocked:'unlocked'
}
},
const VendingMachine = Machine({
id:'vendingMachine',
initial:'idle',
context:{
deposited:0
},
states:{
idle:{
on:{
SELECT_ITEM:{