Skip to content

Instantly share code, notes, and snippets.

View schani's full-sized avatar
⌨️
I just sit at my computer and curse a bit.

Mark Probst schani

⌨️
I just sit at my computer and curse a bit.
View GitHub Profile
@schani
schani / embedding.md
Created October 29, 2018 14:35
Glide Embedding

Integrating glide into your React Native app

After you've built your glide screens, push the "Publish" button, and you'll get an npm install line that you have to run in your project directory, like this:

npm install --save PACKAGE-URL

Now you can import this function from the package you just installed:

{
"Abranchiata": [null, 636, [-555, 281]],
"Andriana": [null, "Carlist"],
"Ansarie": [
null,
[555, 831],
{
"Alida": null,
"Ictonyx": null,
"Ramist": null,
@schani
schani / customizing-quicktype.md
Created June 4, 2018 15:31
Customizing quicktype

FIXME: Fix SHAs

In this post we'll go over the basics required to customize quicktype to suit your needs. Warning: The quicktype API is mostly pretty nice, but also pretty undocumented. It's on our TODO list. If you're curious about anything at all, please don't hesitate to reach out, ideally on Slack.

The example we'll work with is the data model for a game we're writing in C#. We're preparing the model in JSON Schema, and quicktype will generate the C# classes for us. There are two extensions we need:

  1. Some of the types will represent objects in the game, and we want those to be subclasses of GameObject.

  2. We'd like to specify default values for some properties.

{
"status": "success",
"data": {
"time": "00:02:00",
"employees": [
{
"id": 1,
"name": "foo"
},
{
@schani
schani / blocks.json
Last active March 6, 2018 15:09 — forked from dvdsgl/blocks.json
Examples of maps vs classes classified by quicktype Markov chains
{
"0000000000000000000e222e4e7afc29c49f6398783a94c846dee2e13c6408f5": {
"size": 969709,
"height": 510599,
"difficulty": 3007383866429.732,
"previous": "000000000000000000552a7783efd39eaa1c5ff6789e21a0bbe7547bc454fced"
},
"000000000000000000552a7783efd39eaa1c5ff6789e21a0bbe7547bc454fced": {
"size": 991394,
"height": 510598,
// To parse this JSON data, first install
//
// Boost http://www.boost.org
// json.hpp https://github.com/nlohmann/json
//
// Then include this file, and then do
//
// TopLevel data = nlohmann::json::parse(jsonString);
#include <boost/variant.hpp>
// To parse this JSON data, first install
//
// Boost http://www.boost.org
// json.hpp https://github.com/nlohmann/json
//
// Then include this file, and then do
//
// UnionList data = nlohmann::json::parse(jsonString);
#include <boost/optional.hpp>
// To parse this JSON data, first install
//
// Boost http://www.boost.org
// json.hpp https://github.com/nlohmann/json
//
// Then include this file, and then do
//
// TopLevel data = nlohmann::json::parse(jsonString);
#include <boost/optional.hpp>
// To parse this JSON data, first install
//
// Boost http://www.boost.org
// json.hpp https://github.com/nlohmann/json
//
// Then include this file, and then do
//
// topLevel data = json::parse(jsonString);
#include <boost/optional.hpp>
import os
with open('readfile.py') as f:
s = f.read()
print(s)
for i in range(len(s)):
if s[i].isspace():
print("whitespace at %d" % i)
whitespace at 6
whitespace at 9