Check your terminal for next steps 👀
This file contains hidden or 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 hidden or 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
function switch_pg { | |
local version_to_run=$1 | |
local currently_running_version=$(psql --no-psqlrc -t -c 'show server_version;' postgres | xargs) | |
# check if you're erroneously switching to the same version | |
if [ "$version_to_run" = "$currently_running_version" ]; then | |
echo "Postgres $version_to_run is already running." | |
return 1 | |
fi |
This file contains hidden or 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 hidden or 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 hidden or 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}` |
- 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.
Let's say you are experiencing a Postgres error that reads like this: "Postgres running out of temp space".
A potential fix to this is adjusting the work_mem
value for the database.
This will require some tuning to optimize the database for the particular query load that it experiences.
So, some trial and error.
Before getting started, you'll want to take note of the specs of your Postgres instance where these errors occur. You'll be interested in both the available RAM and the number of supported connections.
This file contains hidden or 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
/** @type {import("@johnlindquist/kit")} */ | |
// Exclude: false | |
// Shortcut: control option v | |
const getChromeTabs = await npm("get-chrome-tabs") | |
// grab all tabs for all windows | |
const tabs = await getChromeTabs() |
This file contains hidden or 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
let jxa = await npm("@jxa/run") | |
let result = await jxa.run(() => { | |
let app = Application("com.google.Chrome") | |
let windows = app.windows() | |
let frontWindow = windows[0] | |
let tab = frontWindow.activeTab() | |
let closedTabData = { | |
id: tab.id(), |