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
Rust for rustaceans | |
Ch 1 | |
Uses of multiple lifetime bounds within a single function or type eg a string split iterator | |
Ch 2 | |
Use trait associated types rather than trait genetics except if you expect multiple implementations of the trait for a given type | |
You can use impl trait as the value for an associated type and the compiler will infer the specific type from use eg the return from IntoIterator::into_iter() |
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
{ | |
"CatalogItems": [ | |
{ | |
"CatalogItemId": "OR-FWTFFXJ", | |
"Dimensions": "OUTPOST_RACK", | |
"EC2Capacities": [ | |
{ | |
"Family": "c5", | |
"MaxSize": "24xlarge", | |
"Quantity": "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
/// This function needs to necessarily be conservative. We'd much prefer a | |
/// false negative than a false positive. | |
fn schemas_mutually_exclusive(a: &Schema, b: &Schema) -> bool { | |
match (a, b) { | |
// If either matches nothing then they are exclusive. | |
(Schema::Bool(false), _) => true, | |
(_, Schema::Bool(false)) => true, | |
// If either matches anything then they are not exclusive. | |
(Schema::Bool(true), _) => false, | |
(_, Schema::Bool(true)) => false, |
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
while True: | |
c = getch.getch() | |
if c == 'j': | |
left() | |
elif c == 'k': | |
right() | |
elif c == 'c': | |
break |
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
white = digitalio.DigitalInOut(board.C1) | |
black = digitalio.DigitalInOut(board.C0) | |
black.direction = digitalio.Direction.OUTPUT | |
black.value = True | |
white.direction = digitalio.Direction.OUTPUT | |
white.value = True | |
def tap(v): | |
tnext = time.time() |
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
{ | |
"NextToken": null, | |
"PodCatalogItems": [ | |
{ | |
"AvailableEC2Capacities": [ | |
{ | |
"Family": "m5", | |
"MaxSize": "24xlarge", | |
"Quantity": "6" | |
}, |
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
#!/usr/bin/env python | |
import uuid | |
import json | |
workflow = { | |
"source_id": "271537071011674362", | |
"version": "1", | |
"workflow": { | |
"name": "spam me please", |
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
SELECT status.updateTime, personName.givenName, personName.familyName FROM google_hire.list_applications AS app | |
JOIN google_hire.list_candidates AS can | |
ON app.candidate = can.name | |
WHERE app.tenant = 'my_tenant' | |
AND app.filter='status.state=ACTIVE' | |
AND can.tenant = 'my_tenant' | |
AND can.filter='applications.status.state=ACTIVE' | |
AND job = (SELECT name FROM google_hire.list_jobs | |
WHERE tenant='my_tenant' | |
AND filter='state=OPEN' |
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
({ http_event }) => { | |
var moment = require("moment-timezone-with-data.js"); | |
return { | |
status_code: 200, | |
headers: { "Content-Type": "application/json" }, | |
body: { | |
"text": api.run("this.eng_active", {}) | |
.map((x) => moment(x.updateTime).format("YYYY MMMM Do ") | |
+ x.givenName + " " + x.familyName) |
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
SELECT * FROM google_hire.list_applications AS app | |
JOIN google_hire.list_candidates AS can | |
ON app.candidate = can.name | |
WHERE app.tenant = 'my_tenant' | |
AND app.filter='status.state=ACTIVE' | |
AND can.tenant = 'my_tenant' | |
AND can.filter='applications.status.state=ACTIVE' | |
AND job = (SELECT name FROM google_hire.list_jobs | |
WHERE tenant='my_tenant' | |
AND filter='state=OPEN' |
NewerOlder