Skip to content

Instantly share code, notes, and snippets.

View zeh's full-sized avatar

Zeh Fernando zeh

View GitHub Profile
import { Container, MIPMAP_MODES, SCALE_MODES, Sprite, Texture } from "pixi.js";
import SimpleSignal from "simplesignal";
import Config from "../../../config/Config";
import CameraUtils from "../../utils/CameraUtils";
import FaceTracker from "../../utils/FaceTracker";
import Box from "../shapes/Box";
export default class CameraSprite extends Container {

Idea

#127 "ScrollView in modal prevents modal from dismissing sometimes" - https://github.com/react-navigation/stack/issues/127

This issue has a good discussion and a comment:

brentvatne: it's not really possible for react-navigation to guess when you may or may not want to close the modal depending on other gestures you have inside of a scene, you need to define that behavior for yourself. you can access the gesture context like this: https://github.com/react-navigation/react-navigation-stack/blob/5f157cbc16f2dd15363304ab3c78663b0ed36de0/example/src/GestureInteraction.js#L55-L56 then you can use react-native-gesture-handler tools to make this behave how you like.

/*
Converts ANSi Art source text to console.log()-compatible color codes that work on Chrome and FireFox.
Usage:
console.log.apply(null, ANSIColorUtils.convertToConsole(ansiSource:string, numColumns:number));
Example:
console.log.apply(null, ANSIColorUtils.convertToConsole(`

import * as React from "react";
import * as ReactDOM from "react-dom";
interface IProps {
className?: string;
ratio: number;
style?: Object;
type?: ScaleType;
}
/**
* Validate the scroll position on a container
* This is used to prevent overscrolling on iOS, and avoid flickering (which only happens from the edges)
* It does so by limiting the scroll inside an element to 1..(max-1) instead of 0..max, since attempts to scroll
* an element already at its scrolling ends will scroll the parent instead.
*
* Usage:
* let checker = new SafetyScrollChecker(document.querySelector(".someclass"));
* checker.stop(); // If you want to allow any scrolling
* checker.start(); // Start blocking again
// On Android, every Activity can respond differently to the software keyboard: scrolling to fit, just resizing, overlaying, etc.
// http://developer.android.com/training/keyboard-input/visibility.html
// The C# code below adjusts Unity's current Android Activity to make the keyboard overlay the game, with no size adjustments.
// It is equivalent to calling getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING) in Java.
// Helped method needed for proper UI thread calls (required when accessing context views)
private static void runOnAndroidUiThread(Action target) {
using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
using (var activity = unityPlayer.GetStatic("currentActivity")) {
activity.Call("runOnUiThread", new AndroidJavaRunnable(target));
@zeh
zeh / DoomScreenTransition.glsl
Created May 23, 2014 18:00 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
// Hardcoded parameters --------
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
@zeh
zeh / DreamyZoom.glsl
Last active August 29, 2015 14:01 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
// Definitions --------
#define DEG2RAD 0.03926990816987241548078304229099 // 1/180*PI
// Hardcoded parameters --------
@zeh
zeh / KeyActionBinder_create.as
Last active December 21, 2015 00:38
KeyActionBinder examples
// Creating a KeyActionBinder instance with some bindings
// Declarations ---------
// Action constants for easy use
private static const ACTION_LEFT:String = "left";
private static const ACTION_RIGHT:String = "right";
private static const ACTION_JUMP:String = "jump";
// In your game start ---------