Skip to content

Instantly share code, notes, and snippets.

View keyle's full-sized avatar
👹

keyle

👹
View GitHub Profile
@keyle
keyle / FPS mousemove2.as
Last active August 29, 2015 14:05
Fullscreen FPS the right way?
stage.addEventListener(MouseEvent.MOUSE_MOVE, mousemove, false, 0, true);
scene3D.addEventListener(Scene3D.UPDATE_EVENT, update, false, 0, true);
private function mousemove(event:MouseEvent):void
{
if (event.movementX != 0) {
const mouseMoveX:Number = (event.movementX);
spinX += mouseMoveX * 0.035;
}
@keyle
keyle / FPS mousemove.as
Last active August 29, 2015 14:05
wrong FPS way
// listening to flash stage...
// can't figure out the MouseCollision thing
Main.stage.addEventListener(MouseEvent.MOUSE_MOVE, mousemove, false, 0, true);
// ...
private var tally:Number = 0;
private function mousemove(event:MouseEvent):void
@keyle
keyle / parsleySetup2.as
Last active August 29, 2015 14:05
Parsley 3.0 in AS3 only - NO XML
package
{
import org.spicefactory.parsley.context.ContextBuilder;
import org.spicefactory.parsley.core.context.Context;
public class ParsleyContext
{
public static var context:Context;
public static function init():void
@keyle
keyle / parsleysetup.as
Last active August 29, 2015 14:05
Parsley 3.0 in AS3 only
package
{
public class Model
{
public var test:Array = ["hello", "world"];
}
public class Player
{
[Inject]
@keyle
keyle / Hash.groovy
Created August 15, 2014 13:33
String MD5 hash
package utils
import java.security.MessageDigest
class Hash {
static String md5(String s) {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(s.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
def WITHIN_TRADE_PERIOD = minuteFromStart > 5 && minuteFromStart < 15
def RANGE_IS_SUDDEN = G.RANGE_NOW > 25 && G.RANGE_MIN1 < 15 && G.RANGE_MIN1 < 15
def PRICE_IS_GOING = price > 70 || price < 30
if (WITHIN_TRADE_PERIOD) {
println "potential trade..."
if (RANGE_IS_SUDDEN) {
@keyle
keyle / HDD.groovy
Created August 4, 2014 10:34
Groovy. Write objects to file (json) and read them back
package utils
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
class HDD {
static save(Object content, String filePath) {
new File(filePath).write(new JsonBuilder(content).toPrettyString())
}
@keyle
keyle / webql2.1
Last active August 29, 2015 13:59
webql2.1
webql
from <url|google|ddg>
show <links|text|html|rss>
where? <condition>
to? <screen|csv|json|xml|rss|table>
from google search "key words here"
open 5
display links
@keyle
keyle / webql2 def
Last active August 29, 2015 13:58
webql2
keywords
from <url|rss|google|ddg>
select <jqueryStyleSelector>
where <attr.name|value> <contains|!contains|match> <string|regexp>
limit <num>
skip <num>
reverse
shuffle
first
/// <reference path="phaser.d.ts" />
declare var require;
var game:Phaser.Game;
var cursors:Phaser.CursorKeys;
var flipperLeft:endice.Flipper;
var flipperRight:endice.Flipper;
var ball:endice.Ball;