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
[ | |
{ | |
"AllowedHeaders": [ | |
"*" | |
], | |
"AllowedMethods": [ | |
"GET", | |
"PUT", | |
"POST" | |
], |
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 wsc; | |
// Depending on wsdl chosen, change this to enterprise or partner | |
import com.sforce.soap.enterprise.*; | |
import com.sforce.soap.enterprise.sobject.*; | |
import com.sforce.ws.*; | |
public class Main { | |
public static void main(String[] args) { | |
ConnectorConfig credentials = new ConnectorConfig(); | |
credentials.setPassword("YourPassword!apPenDdedSecurityToken); | |
credentials.setUsername("yoursalesforceusername@yourdomain.com"); |
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
typedef struct CError { | |
int code; | |
char* message; | |
} CError; | |
typedef enum EitherType { | |
intValue = 0, | |
stringValue = 1 | |
} EitherType; | |
typedef struct Either { | |
CError* error; |
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
/* | |
StateDispatcher is declared in C header file. C Function and struct declarations can used directly in Swift. They are mapped to corresponding Swift types. | |
*/ | |
var stateDispatcherFunc: StateDispatcher = { callerPointer, state in | |
if let unwrappedPointer = callerPointer { | |
// ARC related, please ignore for now. | |
let wrapper = Unmanaged<SpeechCoreWrapper> | |
.fromOpaque(unwrappedPointer).takeUnretainedValue() | |
// example from the beginning of this article | |
DispatchQueue.main.async { |
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
val stateJob = flowToCallback( | |
adapterScope, speechRecognizerStateFlow, | |
speechRecognizerStateCallback | |
) | |
fun <T> flowToCallback(scope: CoroutineScope, flow: Flow<T>, | |
callback: Consumer<T>): Job { | |
return scope.launch { | |
try { | |
flow.collect { | |
// invokes the closure which will call C calback |
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
import org.graalvm.nativeimage.c.struct.SizeOf; | |
import static org.graalvm.nativeimage.UnmanagedMemory.calloc; | |
import static org.graalvm.nativeimage.UnmanagedMemory.malloc; | |
public static CSpeechBusinessData allocData() { | |
// malloc() initializes only. allocated space is dirty. | |
CSpeechBusinessData csbd = malloc( | |
SizeOf.get(CSpeechBusinessData.class) | |
); | |
return csbd; |
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
@CContext(Headers.class) | |
public class NativeInterface { | |
public static class Headers implements CContext.Directives { | |
@Override | |
public List<String> getHeaderFiles() { | |
return Collections.unmodifiableList( | |
Arrays.asList("header.h") | |
) | |
} | |
} |
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
// allocate create isolate arguments | |
let isolate = UnsafeMutablePointer<OpaquePointer?> | |
.allocate(capacity: 1) | |
let params = UnsafeMutablePointer<graal_create_isolate_params_t> | |
.allocate(capacity: 1) | |
let graal_thread = UnsafeMutablePointer<OpaquePointer?> | |
.allocate(capacity: 1) | |
// create isolate | |
let ret = graal_create_isolate(self.params, self.isolate, graal_thread) | |
if ret != 0 { |
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> <!-- Declaring that's that the file is html--> | |
<html lang="en"> <!-- Showing that the document is in English--><head><title>JavaScript - read JSON from URL</title> | |
<!-- Importing JQuery--> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | |
</head> | |
<body> | |
<div class="entree0"></div> | |
<script> | |
const today = new Date(); | |
const yyyy = today.getFullYear(); |
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
const today = new Date(); | |
const yyyy = today.getFullYear(); | |
let mm = today.getMonth() + 1; // Months start at 0! | |
let dd = today.getDate(); | |
var todayy = new Date(); | |
if (dd < 10) dd = '0' + dd; | |
if (mm < 10) mm = '0' + mm; | |
const formattedToday = mm + '/' + dddd + '/' + yyyy; | |
mylink = "https://www.sagedining.com/microsites/getMenuItems?menuId=110277&date=" + formattedToday + "&meal=Lunch"; | |
console.log(mylink) |