Skip to content

Instantly share code, notes, and snippets.

View Iorpim's full-sized avatar

Otavio Brito Iorpim

View GitHub Profile
@Iorpim
Iorpim / graphQLResolve.js
Created September 23, 2022 00:31
Quick and dirty GraphQL parameter extractor and translator.
var { parse, buildSchema, validate } = require("graphql"); // npm install graphql-js
function parseValue(argument, variables) {
switch(argument.kind) {
case "StringValue":
return argument.value;
case "Variable":
if(!(argument.name.value in variables)) {
throw new Error(`Invalid variable name ${argument.name.value} provided`);
}
@Iorpim
Iorpim / argsParse.cs
Last active May 10, 2021 17:50
Simple C# string argument parser
public string[] parseArgs(string args) {
List<string> ret = new List<string>();
char separator = ' ';
bool escaped = false;
StringBuilder arg = new StringBuilder();
for(int i = 0; i < args.Length; i++) {
if(escaped) {
arg.Append(args[i]);
escaped = false;
continue;

Keybase proof

I hereby claim:

  • I am Iorpim on github.
  • I am iorpim (https://keybase.io/iorpim) on keybase.
  • I have a public key whose fingerprint is 6627 F702 853B CED0 455B AC3F 4D97 82FC 1B8B 152B

To claim this, I am signing this object: