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
// Decode the request | |
type TargetObject struct { | |
ID string `json:"id"` | |
} | |
// binaryOfOurSourcePayload = []byte(`{"id": "ABC123"}`) | |
var targetObject TargetObject | |
err = json.Unmarshal(binaryOfOurSourcePayload, &targetObject) | |
if err != nil { |
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
{ | |
"attributes": { | |
"type": "Account", | |
"url": "/services/data/v43.0/sobjects/Account/XXX1234567890" | |
}, | |
"Id": "XXX1234567890", | |
"IsDeleted": false, | |
"Name": "Sample Account", | |
"Phone": "8015551234", | |
"Welcome_Call_Completed__c": 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
<!DOCTYPE html> | |
<html> | |
<ul id="todo-list"> | |
</ul> | |
// [{"name":"Hit the Gym","is_completed":false},{"name":"Go to the store","is_completed":true}, {"name": "get guhd", "is_completed": true}] | |
<script> | |
const LOCAL_STORAGE_TODO_LIST = "LOCAL_STORAGE_TODO_LIST"; |
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
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}.App{text-align:center}.App-logo{height:40vmin;pointer-events:none}@media (prefers-reduced-motion:no-preference){.App-logo{-webkit-animation:App-logo-spin 20s linear infinite;animation:App-logo-spin 20s linear infinite}}.App-header{background-color:#282c34;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:calc(10px + 2vmin);color:#fff}.App-link{color:#61dafb}@-webkit-keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} | |
/*# sourceMappingURL=main.5f361e03.chunk.css.map */ |
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
# NESTED FOR LOOP | |
def create_deck do | |
values = ["Ace", "Two", "Three", "Four", "Five"] | |
suits = ["Spades", "Clubs", "Hearts", "Diamonds"] | |
# list comprehension. Basically a .map() function | |
for suit <- suits, value <- values do | |
"#{value} of #{suit}" | |
end | |
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
// an abbreviated, fictional example of a database method you might find at Weave | |
func (p personService) CreateOrUpdate(ctx context.Context, person app.Person) (app.Person, error) { | |
var result app.Person | |
query := ` | |
INSERT INTO persons | |
( | |
id, | |
first_name, | |
last_name, |
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
function createUser(name, age, address) { | |
try { | |
validateUser({name, age, address}) | |
} catch (err) { | |
throw Error("User is not valid") | |
} | |
// insert into database, then return result | |
return db.insertUser({name, age, address}) | |
} |
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
function createUser(name, age, address) { | |
if (age < 13) { | |
throw Error("user must be older than 13 to register") | |
} | |
// insert into database, then return result | |
return db.insertUser({name, age, address}) | |
} |
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
-- name: SetPreProvisionFields :exec | |
UPDATE provisions | |
SET provisioned_at = now(), | |
location_id = $2 | |
WHERE salesforce_opportunity_id = $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
func Test_functionA(t *testing.T) { | |
type args struct { | |
a int | |
b int | |
} | |
tests := []struct { | |
name string | |
args args | |
want int | |
wantErr bool |
NewerOlder