Skip to content

Instantly share code, notes, and snippets.

View slaskis's full-sized avatar
🤓

Robert Sköld slaskis

🤓
View GitHub Profile
@slaskis
slaskis / dm-fail.rb
Created November 15, 2010 21:32
DataMapper generates the wrong SQL query with some relationships.
require "rubygems"
require "datamapper"
class Person
include DataMapper::Resource
property :id, Serial
property :name, String, :required => true
property :role, String, :set => %w(boss rookie)
module DataMapper
class Collection
# A query friendlier group_by method
def group_by
assoc = {}
self.each do |item|
key = yield(item)
if assoc.has_key? key
assoc[key] << item
else
$sql = "SELECT word, COUNT(word) AS count FROM log WHERE true ";
if( isset($_GET["c"]) && $_GET["c"] != "" ) $sql .= " AND county = ". $_GET["c"];
if( isset($_GET["g"]) && $_GET["g"] != "" ) $sql .= " AND gender = '". $_GET["g"] ."'";
if( isset($_GET["b"]) && $_GET["b"] != "" ) $sql .= " AND age BETWEEN ". $_GET["b"] ." AND ". $_GET["t"];
$sql .= " GROUP BY word ORDER BY count DESC LIMIT 10";
diff --git a/swflib/actionScript.ml b/swflib/actionScript.ml
index f8d9f04..05e5dce 100644
--- a/swflib/actionScript.ml
+++ b/swflib/actionScript.ml
@@ -208,7 +208,7 @@ let action_data_length = function
| _ ->
0
-let action_length a =
+let action_length a =
class DisplayObjectUtil {
public static function iterator( obj : flash.display.DisplayObjectContainer ) {
var i = 0;
return {
next: function(){
return obj.getChildAt(i++);
},
hasNext: function(){
return i < obj.numChildren;
}
brew install bazaar
==> Downloading http://launchpadlibrarian.net/41811693/bzr-2.1.1.tar.gz
######################################################################## 100.0%
==> make man1/bzr.1
==> /usr/bin/gzip man1/bzr.1
==> make
building extension modules.
python setup.py build_ext -i
No Pyrex, trying Cython...
*** /Users/slaskis/test/src/Main.cpp 2010-04-12 09:02:24 +0200
--- /Users/slaskis/test2/src/Main.cpp 2010-04-12 09:04:10 +0200
***************
*** 37,48 ****
}
};
Dynamic properties = _Function_1_1::Block();
struct _Function_1_2{
inline static Dynamic Block( ){
hx::Anon __result = hx::Anon_obj::Create();
require "rubygems"
require "dm-core"
require "pp"
DataMapper::Logger.new(STDOUT,:debug)
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/bula.db")
class Entry
Index: Makefile
===================================================================
--- Makefile (revision 3171)
+++ Makefile (working copy)
@@ -1,45 +1,73 @@
-EXTLIB=../../mtcvs/extlib-dev
-SWFLIB=../../mtcvs/swflib
-EXTC=../../mtcvs/extc
-NEKO=../neko
-XML=../../mtcvs/xml-light
class Test extends flash.display.Sprite {
public function new() {
super();
var bmd = new flash.display.BitmapData( 200 , 200 );
var channels = flash.display.BitmapDataChannel.RED | flash.display.BitmapDataChannel.BLUE;
bmd.perlinNoise(100, 80, 6, Math.floor(Math.random() * 10), false, true, channels, false, null);
var o = new haxe.io.BytesOutput();