Skip to content

Instantly share code, notes, and snippets.

View simistern's full-sized avatar
🍊

Simon Stern simistern

🍊
View GitHub Profile
@simistern
simistern / alle
Created March 3, 2022 19:45
APpDelegate
#import "AppDelegate.h"
#import <RNBranch/RNBranch.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLinkingManager.h>
#import <AppCenterReactNative.h>
/**
* 1. Initialize new node project (npm init -y)
* 2. Run: npm install ethers
* 3. Add private key where PRIVATE_KEY
* 4. Optionally, update gas price (line 29) or chosen gas limit
* 5. Run: node mint-temporal-loot.js
* 6. NOTE: Don't forget to get an API key fgrom Alchemy and replace the variable in line 15
*/
// Imports
require("dotenv").config();
import { Client, oauth2 } from 'ketting';
const client = new Client('api.example.org');
client.use(oauth2({
grantType: 'password',
clientId: 'fooClient',
clientSecret: 'barSecret',
tokenEndpointUri: 'https://api.example.org/oauth/token',
scopes: ['test']
userName: 'fooOwner',
password: 'barPassword'
const ArticleView = () => {
const { loading, error, data } = useResource<Article>('/article/1');
if (loading) return <p>Loading…</p>;
if (error) return <div class="error">{error.message}</div>;
return (
<article>
<h1>{data.title}</h1>
<p>{data.body}</p>
</article>
)
const authorCollection = await authorResource.follow('author-collection');
const newAuthor:Author = {
firstName: 'Ursula',
lastName: 'Le Guin',
};
const newAuthorResource = await authorCollection.post(newAuthor);
const ketting = new Ketting('https://api.example.org/');
const createArticle = await ketting.follow('articleCollection').follow('new'); // chained follow
const newArticle = await createArticle.post({ title: 'Hello world' });
const author = await newArticle.follow('author');
// Output author information
console.log(await author.get());
@simistern
simistern / .json
Last active November 20, 2020 16:55
ketting example
{
"_links": {
"self": {
"href": "/author/4554"
},
"curries": [
{
"name": "ns",
"href": "http://booklistapi.com/rels/{rel}",
"templated": true
echo "Cleaning up node modules";
rm -rf node_modules;
npm install;
echo "Clearning all temp directories";
rm -rf $TMPDIR/react-native-packager-cache-*;
rm -rf $TMPDIR/metro-*;
rm -rf $TMPDIR/react-*;
rm -rf $TMPDIR/haste-*;
watchman watch-del-all;
echo "Cleaning up iOS folders"
componentDidUpdate(prevProps, prevState){
if(prevState.foo !== this.state.foo){
...do the thing
}
}
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>CSS Stylesheets with Relative Paths</title>
</head>
<body>
<header>