Skip to content

Instantly share code, notes, and snippets.

View SnugglePilot's full-sized avatar
🏠
Working from home

Andy Moore SnugglePilot

🏠
Working from home
View GitHub Profile
@SnugglePilot
SnugglePilot / gist:1128805
Created August 5, 2011 23:58 — forked from kevinpeno/gist:1128700
SQL to get all recipes that contain all ingredients the user has
CREATE VIEW view_recipe_by_ingredient AS
SELECT R.id, R.name, RI.liquorID
FROM recipes R
JOIN recipeIngredients RI ON RI.recipeID = R.id;
CREATE VIEW view_recipes_in_cabinet AS
SELECT L.userID, RbI.name, RbI.id, COUNT( RbI.liquorID ) as LiquorCount
FROM view_recipe_by_ingredient RbI
LEFT JOIN liquorCabinet L USING (liquorID)
GROUP BY RbI.name;
@SnugglePilot
SnugglePilot / gist:1128882
Created August 6, 2011 01:26
Sample Data for SQL Ingredient Selection
GOAL:
To create a database of liquor in your liquor cabinet, and a database of possible drinks to make.
Output:
(1) a list of drinks you can make with your existing liquors, (hard!) and
(2) a list of drinks you could make if you just bought a few more things
===
private var scaleAmount:Float;
private var overrideTween:Bool;
public function bubbleOnMouseOver(scaleAmount:Float = 1.2, overrideTween:Bool = true):Void {
//trace("WSprite's bubbleOnMouseOver is broken with Actuate. Disabled.");
//return;
this.overrideTween = overrideTween;
this.scaleAmount = scaleAmount;
addEventListener(MouseEvent.MOUSE_OVER, mouseOverGrow);
}
protected static var _lumR:Number = 0.212671;
protected static var _lumG:Number = 0.715160;
protected static var _lumB:Number = 0.072169;
public function ColorManip() { }
static public function colorize(color:Number, amount:Number = 1):Array {
if (isNaN(amount)) {
amount = 1;
}
path = new MotionPath();
for (tile in currentSelection) {
path = path.bezier(tile.centerX, tile.centerY, tile.centerX, tile.centerY);
}
Actuate.tween(this, time, { x:path.x, y:path.y }, true);
function onStageResize(e:Event) {
// Not pictured: backdrop is a Sprite that has .addChild(new Bitmap()) graphics contained.
// Using Haxe3 + openFL 1.0
if (stage.stageWidth > stage.stageHeight) {
// This always works:
backdrop.rotation = 0;
backdrop.x = 0;
backdrop.y = 0;
package ;
using irl.SaveData;
class MySaveData {
static inline var myVar = "HELLO";
}
var s:Sprite;
function show() {
s = new Sprite();
addChild(new Bitmap(Assets.getBitmapData("sadTrombone.png")));
}
function kill() {
removeChild(s);
s = null;
actuate: [1.7.0]
format: [3.0.4]
haxe-ga: [0.4.1]
hxlibc: [1.0.0]
hxtools: 1.1.2 1.1.3 [1.1.5]
irl: git [dev:/usr/lib/haxe/lib/irl/git]
msignal: [1.2.2]
openfl: [1.1.0]
openfl-html5-dom: [1.1.0]
openfl-native: 1.1.0 1.1.1 [1.1.3]
import project.*;
class Project extends HXProject {
public function new () {
super ();
meta = { title: "Monster Loves You!", packageName: "com.radialgames.MonsterLovesYou", version: "0.99.1", company: "Radial Games Corp." };
app = { main: "Main", path: "bin", file: "MonsterLovesYou" };
#if mobile