- https://spectrum.chat/statecharts/general/when-to-use-react-state-and-when-to-use-xstate-context~e32d06e2-3389-4228-9fa9-e5df745871e6
- https://twitter.com/mpocock1/status/1345083512173555712
- https://twitter.com/tannerlinsley/status/1345085887026106368
- https://css-tricks.com/using-react-and-xstate-to-build-a-sign-in-form/
- In the wild! Where are you using XState
- Elm: How do we feel about state machines?
- [Things I wish I knew about state management when I started writing React apps](https://news.ycombinator.
This file contains 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
results = `git log HEAD@{'7 days ago'}..HEAD --oneline | sed 's/^\([[:alnum:]]*\) .*$/\1/'` | |
commit_list = results.split(/\n/).map do |item| | |
item.split(' ', 2) | |
end.filter do |sha, commit_message| | |
commit_message.start_with?('Add ') | |
end | |
commit_data = commit_list.map do |sha, commit_message| | |
diff_tree_result = `git diff-tree --no-commit-id --name-only -r #{sha}` |
This file contains 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
def sometimes_fails | |
puts "Beginning of sometimes_fails" | |
begin | |
retries ||= 0 | |
puts "About to do a thing (#{retries})" | |
raise StandardError if rand(5) != 4 | |
puts "Success!" |
This file contains 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 Thing | |
def initialize(value) | |
@value = value | |
end | |
def call(other_value) | |
@other_value = other_value | |
puts final_value | |
end |
This file contains 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
-- create temp table with sample input | |
insert into xmas_data (value) values (35), (20), (15), (25), (47), (40), (62), (55), (65), (95), (102), (117), (150), (182), (127), (219), (299), (277), (309), (576); | |
-- starter subquery | |
select | |
v1.id v1id, | |
v2.id v2id, | |
v1.value, | |
v2.value, | |
v1.value + v2.value sum |
This file contains 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
/* | |
* Keeping the postconditions of Abs the same as above, change | |
* the body of Abs to just y := x + 2. What precondition do you | |
* need to annotate the method with in order for the verification | |
* to go through? What precondition doe you need if the body is | |
* y := x + 1? What does that precondition say about when you can | |
* call the method? | |
*/ | |
method Abs(x: int) returns (y: int) | |
requires x == -1; |
This file contains 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
#!/bin/bash | |
# the first argument is the string you are looking for --> $1 | |
searchString="$1" | |
for f in `find . -type f -name "*.java"` | |
do | |
result=`grep "$searchString" $f` |
This file contains 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
# Convert a CSV like the following: | |
# a,b,c,d,e,f,g | |
# To the LaTeX table format like the following: | |
# {a} & {b} & {c} & {d} & {e} & {f} & {g} \\\hline | |
sed 's/,/} \& {/g' Table1.csv | sed 's/^/{/' | sed 's/$/} \\\\\\hline/' > Table1Format.txt |
This file contains 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
package main | |
import "golang.org/x/tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
var picArray [][]uint8 | |
picArray = make([][]uint8, 0, dy) | |
for i := 0; i < dy; i++ { | |
var currX []uint8 | |
currX = make([]uint8, 0, dx) |