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
ARIADNE + GRAPHQL: ROBUST BASIS FOR A CODE GENERATOR TO MAKE GRAPHQL SERVERS IN PYTHON | |
This is a simple example to show how a couple of small wrapper classes can take | |
Ariadne's relatively non-modular approach, and slide a compatibility layer in to | |
make it possible to declare classes with methods that map directly to resolvers | |
for fulfilling a GraphQL schema. | |
The method names are marked with "@resolver", and the class name should exactly match the | |
type name in the schema. Each class is defined in its own "model" file, and there are two | |
special classes for the root queries & mutators. |
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
<script> | |
// ^^^ | |
// Keep the <script> tags when copying into Wiki.JS page editor | |
async function fetchAllPages() { | |
const graphqlEndpoint = "/graphql"; | |
const query = ` | |
query GetAllPages { | |
pages{ | |
list(limit: 1000, orderBy: PATH, orderByDirection: ASC) { |
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 java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Random; | |
public class PracticalFour { | |
/** | |
* Throw an exception of the given 'type' in the arguments list, | |
* or print "No problems" if 'NONE' | |
* | |
* Work on this until: 8:21 |
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
String num(int value) { | |
// Q1.1 Solution | |
switch (value) { | |
case 1: | |
return "one"; | |
case 2: | |
return "two"; |
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 java.io.*; | |
import java.util.*; | |
public class Schedule { | |
private List<Flight> flights; | |
public Schedule(List<Flight> flights) { | |
this.flights = flights; | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 10 columns, instead of 5. in line 8.
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
row,start_address,end_address,start_lat,start_lon,end_lat,end_lon,duration(seconds),distance(meters),mode | |
0,Albion QLD 4010 Australia,Ascot QLD 4007 Australia,-27.4319627,153.046257,-27.4320055,153.0654789,309,2523,DRIVING | |
1,Albion QLD 4010 Australia,Ascot QLD 4007 Australia,-27.4319627,153.046257,-27.4320055,153.0654789,585,2698,TRANSIT | |
2,Albion QLD 4010 Australia,Auchenflower QLD 4066 Australia,-27.4319627,153.046257,-27.4755681,152.9916783,741,8232,DRIVING | |
4,Albion QLD 4010 Australia,Balmoral QLD 4171 Australia,-27.4319627,153.046257,-27.4541422,153.0669507,958,10820,DRIVING | |
5,Albion QLD 4010 Australia,Balmoral QLD 4171 Australia,-27.4319627,153.046257,-27.4541422,153.0669507,5092,15011,TRANSIT | |
6,Albion QLD 4010 Australia,Bardon QLD 4065 Australia,-27.4319627,153.046257,-27.461372,152.9748871,1011,9963,DRIVING | |
7,Albion QLD 4010 Australia,Bardon QLD 4065 Australia,-27.4319627,153.046257,-27.461372,152.9748871,3188,11905,TRANSIT | |
8,Albion QLD 4010 Australia,Brisbane City QLD 4000 Australia,-27.4319627,153.046 |
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
using System; | |
using System.Collections.Generic; | |
namespace flowtasks | |
{ | |
/// <summary> | |
/// Manages performing a set of tasks in a well-defined sequence, allowing holdoff to | |
/// when data or next-state information is available. | |
/// | |
/// The next task is run by the manager, passed the arguments given to the Step method, and |
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
// Super Simple Node Server | |
var http = require('http'); | |
var fs = require('fs'); | |
var wd = process.cwd(); | |
var serve; | |
console.log('Current directory: ' + process.cwd()); | |
// Colors! ^.^ | |
var white_c = "\033[1;39m"; |
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
cd "$1" | |
# Make sure they're confident that this is the correct directory | |
printf "\nAre you sure you want to completely wreck directory '%s'?\n" "$(pwd)" | |
prompt=b | |
until [[ "$prompt" =~ (yes|no) ]]; do | |
read -p "(Yes / No): " prompt | |
done | |
if [[ "$prompt" =~ no ]]; then | |
exit 0; |