-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48d9c1a
commit 7b7b710
Showing
96 changed files
with
8,036 additions
and
2,960 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const code = `REPORT zrosetta_base64_encode_data. | ||
DATA: li_client TYPE REF TO if_http_client, | ||
lv_encoded TYPE string, | ||
lv_data TYPE xstring. | ||
cl_http_client=>create_by_url( | ||
EXPORTING | ||
url = 'http://rosettacode.org/favicon.ico' | ||
IMPORTING | ||
client = li_client ). | ||
li_client->send( ). | ||
li_client->receive( ). | ||
lv_data = li_client->response->get_data( ). | ||
CALL FUNCTION 'SSFC_BASE64_ENCODE' | ||
EXPORTING | ||
bindata = lv_data | ||
IMPORTING | ||
b64data = lv_encoded. | ||
WHILE strlen( lv_encoded ) > 100. | ||
WRITE: / lv_encoded(100). | ||
lv_encoded = lv_encoded+100. | ||
ENDWHILE. | ||
WRITE: / lv_encoded. | ||
`; | ||
|
||
export default code; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const code = `// Contract simulating developers organization | ||
contract HackBG = | ||
record state = { developers: map(address, developer) } | ||
record developer = { name: string | ||
, age: int | ||
, skillset: map(skill, experience) } | ||
type skill = string | ||
type experience = int | ||
datatype event = | ||
LogDeveloperAdded(indexed address, indexed int, string) | ||
entrypoint init() : state = { developers = {} } | ||
stateful entrypoint dev_add(account: address, dev_name: string, dev_age: int) = | ||
require(!is_member(account), "ERROR_DEVELOPER_ALREADY_EXISTS") | ||
let dev : developer = { name = dev_name | ||
, age = dev_age | ||
, skillset = {} } | ||
put(state{ developers[account] = dev }) | ||
Chain.event(LogDeveloperAdded(account, Chain.timestamp, dev_name)) | ||
stateful entrypoint dev_update(account: address, dev_name: string, dev_age: int) = | ||
require(is_member(account), "ERROR_DEVELOPER_DOES_NOT_EXIST") | ||
put(state{ developers[account].name = dev_name }) | ||
put(state{ developers[account].age = dev_age }) | ||
function is_member(account: address) : bool = | ||
Map.member(account, state.developers) | ||
stateful entrypoint dev_skill_modify(account: address, skill: string, experience: int) = | ||
put(state{ developers[account].skillset[skill] = experience }) | ||
entrypoint dev_get(account: address) : developer = | ||
state.developers[account]`; | ||
|
||
export default code; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const code = `/* Using a single database query, find all the leads in | ||
the database that have the same email address as any | ||
of the leads being inserted or updated. */ | ||
for (Lead lead : [SELECT Email FROM Lead WHERE Email IN :leadMap.KeySet()]) { | ||
Lead newLead = leadMap.get(lead.Email); | ||
newLead.Email.addError('A lead with this email address already exists.'); | ||
} | ||
`; | ||
|
||
export default code; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const code = `# Create a resource group. | ||
az group create --name myResourceGroup --location westeurope | ||
# Create a new virtual machine, this creates SSH keys if not present. | ||
az vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --generate-ssh-keys`; | ||
|
||
export default code; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const code = `rem *******Begin Comment************** | ||
rem This program starts the superapp batch program on the network, | ||
rem directs the output to a file, and displays the file | ||
rem in Notepad. | ||
rem *******End Comment************** | ||
@echo off | ||
if exist C:\output.txt goto EMPTYEXISTS | ||
setlocal | ||
path=g:\programs\superapp;%path% | ||
call superapp>C:\output.txt | ||
endlocal | ||
:EMPTYEXISTS | ||
start notepad c:\output.txt`; | ||
|
||
export default code; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const code = `targetScope = 'subscription' | ||
param deployStorage bool = true | ||
@description('The object ID of the principal that will get the role assignment') | ||
param aadPrincipalId string | ||
module stg './storage.bicep' = if(deployStorage) { | ||
name: 'storageDeploy' | ||
scope: resourceGroup('another-rg') // this will target another resource group in the same subscription | ||
params: { | ||
storageAccountName: '<YOURUNIQUESTORAGENAME>' | ||
} | ||
} | ||
var contributor = 'b24988ac-6180-42a0-ab88-20f7382dd24c' | ||
resource roleDef 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = { | ||
name: contributor | ||
} | ||
resource rbac 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = { | ||
name: guid(subscription().id, aadPrincipalId, contributor) | ||
properties: { | ||
roleDefinitionId: roleDef.id | ||
principalId: aadPrincipalId | ||
} | ||
} | ||
output storageName array = stg.outputs.containerProps | ||
`; | ||
|
||
export default code; |
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
Oops, something went wrong.