This file contains hidden or 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
// compile and run with | |
// c3c compile-run adventure.c3 | |
import std::ascii; | |
import std::collections; | |
import std::io; | |
struct Item | |
{ | |
String name; |
This file contains hidden or 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 BYTES_PER_QUAD = 16; | |
const BUFFER_SIZE = BYTES_PER_QUAD * 200000; | |
export class SpriteRenderer { | |
gl: WebGL2RenderingContext; | |
dataView: DataView; | |
index = 0; | |
constructor(canvas: HTMLCanvasElement, spriteSheet: HTMLImageElement, spriteSize = BYTES_PER_QUAD, pixelSize = 4) { | |
const gl = canvas.getContext("webgl2"); |
This file contains hidden or 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
use futures::task::{Context, Poll}; | |
use std::cell::RefCell; | |
use std::future::Future; | |
use std::pin::Pin; | |
use std::rc::Rc; | |
use wasm_bindgen::prelude::*; | |
use wasm_bindgen::JsCast; | |
use web_sys::HtmlImageElement; | |
/// A future for loading a [HtmlImageElement](https://docs.rs/web-sys/0.3.39/web_sys/struct.HtmlImageElement.html) |
This file contains hidden or 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 React from "react"; | |
import {Context, RefObject} from "react"; | |
declare module "react" { | |
function useState<T>(initialState?: T): [T, (value: T) => void]; | |
function useEffect(effect: () => (() => void) | void, dependencies?: Array<any>): void; | |
function useContext<C>(context: Context<C>): C; | |
function useReducer<S>(reducer: (state: S, action: any) => S, initialState?: S, initialAction?: any): [S, (args: any) => void]; | |
function useCallback(callback: () => void, dependencies?: Array<any>): () => void; | |
function useMemo<R>(fn: () => R, dependencies?: Array<any>): R; |
This file contains hidden or 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
repositories { | |
ivy { | |
url "https://google-web-toolkit.googlecode.com/svn/tools/lib" | |
layout "pattern", { | |
artifact "[artifact]-[revision].[ext]" | |
} | |
} | |
} | |
configurations { |
This file contains hidden or 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
public class GwtRpcLinter { | |
public static final String PACKAGE_PREFIX = "com.yourcompany"; // only check classes in this package | |
private TreeLogger logger; | |
private GeneratorContext context; | |
private List<String> errorMessages = new ArrayList<>(); | |
public GwtRpcLinter(TreeLogger logger, GeneratorContext context) { | |
this.logger = logger; | |
this.context = context; |
This file contains hidden or 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
public void newStyleCopyFile(File source, File target) { | |
try ( | |
FileInputStream in = new FileInputStream(source); | |
FileOutputStream out = new FileOutputStream(target); | |
) { | |
byte[] buffer = new byte[4096]; | |
int read; | |
while ((read = in.read(buffer)) != -1) { | |
out.write(buffer, 0, read); | |
} |
This file contains hidden or 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
public void createGenerics() { | |
List<String> list = new ArrayList<String>(); | |
Map<String, List<String>> keyValues = new HashMap<String, List<String>>(); | |
} | |
public void createWithDiamondOperator() { | |
List<String> list = new ArrayList<>(); | |
Map<String, List<String>> keyValues = new HashMap<>(); | |
} |