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
{ | |
YellowLaser: BulletConfig( | |
damage: 234.0, | |
shoot_rate: 12.0, | |
speed: 123.0, | |
assets: BulletAssets( | |
animations: BulletAnimations( | |
hit_splash: Directional(( | |
left: Animation( | |
sprite_sheet: SpriteSheetDescriptor( |
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 bevy_editor_pls::prelude::*; | |
use bevy::prelude::*; | |
use leafwing_input_manager::{InputManagerBundle, prelude::{ActionState, InputMap}, Actionlike, plugin::InputManagerPlugin}; | |
#[derive(Actionlike, PartialEq, Eq, Clone, Copy, Hash, Debug)] | |
pub enum PlayerAction { | |
Fire, | |
MoveLeft, | |
MoveRight, | |
MoveUp, |
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 chunkSize = 1000 | |
const bufs = [] | |
try { | |
do { | |
bufs.push(Buffer.alloc(chunkSize * 1024 * 1024, 'x')) | |
} while (true) | |
} catch (e) { | |
console.log('stopping and ', Math.round(process.memoryUsage().rss / (1024 * 1024))) | |
} |
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 amethyst::{ | |
assets::{AssetStorage, Handle, Loader, ProgressCounter}, | |
prelude::*, | |
renderer::{formats::texture::ImageFormat, SpriteSheet, SpriteSheetFormat, Texture}, | |
}; | |
use crate::menu::MenuState; | |
#[derive(Debug)] | |
pub struct HandleDesc { |
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 bitwiseTruncator = length => number => number & (Math.pow(2, length)-1); | |
((length, cTestNumbers, cTestNumbersMaxSize=999999)=>{ | |
const numbers = Array.from({length: cTestNumbers}).map(()=>Math.ceil(Math.random()*cTestNumbersMaxSize)) | |
const truncatedNumbers = numbers.map(bitwiseTruncator(length)) | |
numbers.map((number)=>console.log(`was: ${number.toString(2)}`)) | |
truncatedNumbers.map((number)=>console.log(`now: ${number.toString(length).padStart(length, "0")}`)) | |
})(3, 7) |
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
// tslint:disable | |
export type UnpackPromise<T> = T extends Promise<Array<infer U>> ? U[] : T extends Promise<infer D> ? D : T; | |
type DeltaFn<ARG extends any[], R> = (...args: UnpackPromise<ARG>) => R | PromiseLike<R>; | |
type RiverFn<ARG, R> = (arg: UnpackPromise<ARG>) => R | PromiseLike<R>; | |
function pipe<A extends any[]>(): (...args: A) => UnpackPromise<A>; | |
function pipe<A extends any[], R1>(f1: DeltaFn<A, R1>): (...args: A) => Promise<R1>; | |
function pipe<A extends any[], R1, R2>(f1: DeltaFn<A, R1>, f2: RiverFn<R1, R2>): (...args: A) => Promise<R2>; | |
function pipe<A extends any[], R1, R2, R3>( | |
f1: DeltaFn<A, R1>, | |
f2: RiverFn<R1, R2>, |
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 jsLangs = (context, error) => node => node.arguments.map((arg) => { | |
if (arg.type === 'Identifier') { | |
context.report({ | |
node, | |
messageId: error, | |
data: { name: arg.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 noDynTranslationKeys = require('./no-dyn-translation-keys') | |
module.exports = { | |
rules: { | |
'no-dynamic-translation-keys': noDynTranslationKeys | |
} | |
}; |
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 dataStream = Rx.Observable.create((observer)=>{ | |
setInterval(()=>{ | |
const value = Math.ceil(Math.random()*100) | |
observer.next(value) | |
}, 1000) | |
}) | |
dataStream.subscribe((o)=>console.log(o)) | |
dataStream | |
.filter(a=>a<10) | |
.subscribe(d=>console.log("--->", d)) |
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
class Cursor{ | |
position: Core.Point = new Core.Point() | |
onChangePosition = new Phaser.Signal() | |
place(position: Core.Point){ | |
this.position = position | |
this.onChangePosition.dispatch(this.position) | |
} | |
NewerOlder