Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vshymanskyy committed Aug 21, 2024
1 parent 841aba8 commit 252ad4f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,14 @@ export async function pyMinify() {
return
}

const res = await minifyPython(editor.state.doc.toString())
const input = editor.state.doc.toString()
const res = await minifyPython(input)

editor.dispatch({
changes: { from: 0, to: editor.state.doc.length, insert: res }
})

toastr.info(`Minified ${input.length} to ${res.length}`)
}

export async function pyPrettify() {
Expand Down
34 changes: 19 additions & 15 deletions src/emulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,25 @@ async function populateFS(vm)
# Most things work: you can edit and run files, use the Terminal, install packages, etc.
# WARNING: if your script takes a long time to run, the browser will busy-wait
colors = [
"\\033[31m", "\\033[32m", "\\033[33m", "\\033[34m",
"\\033[35m", "\\033[36m", "\\033[37m",
]
reset = "\\033[0m"
text = " ${T('example.hello', 'Привіт')} MicroPython! 𓆙"
# ${T('example.comment-colors', 'Print each letter with a different color')}
print("=" * 32)
for i, char in enumerate(text):
color = colors[i % len(colors)]
print(color + char, end="")
print(reset)
print("=" * 32)
def main():
colors = [
"\\033[31m", "\\033[32m", "\\033[33m", "\\033[34m",
"\\033[35m", "\\033[36m", "\\033[37m",
]
reset = "\\033[0m"
text = " ${T('example.hello', 'Привіт')} MicroPython! 𓆙"
# ${T('example.comment-colors', 'Print each letter with a different color')}
print("=" * 32)
for i, char in enumerate(text):
color = colors[i % len(colors)]
print(color + char, end="")
print(reset)
print("=" * 32)
if __name__ == "__main__":
main()
`);

// ----------------------------------------------------------------------
Expand Down

0 comments on commit 252ad4f

Please sign in to comment.