Skip to content

Instantly share code, notes, and snippets.

View ashgti's full-sized avatar

John Harrison ashgti

View GitHub Profile
# thanks to @judofyr for explaining this to me like thus:
# when ruby sees "bar =" (even thought it's not eval'd) it creates a local variable and assigns it to nil.
# so the first "bar" is a method call, while the second is a local variable. it should work if you replace
# it with "self.bar".
class Foo
attr_accessor :bar, :id
def initialize id
@id = id
# version 1
sub infix:<Z>(*@@args) {
my @lists = @@args>>.list;
gather {
take @lists>>.shift while all(@lists);
}
}
var queries = {
1 : "SELECT Title FROM Books WHERE Unit_in_Stock > 5",
2 : "SELECT SUM(b.Unit_Price * od.Quantity) as total FROM Books AS b INNER JOIN OrderDetails AS od ON b.BookID = od.BookID INNER JOIN Orders AS o ON o.OrderID = od.OrderID INNER JOIN Customers AS c ON o.CustomerID = c.CustomerID WHERE LastName = \"Smith\" AND FirstName = \"John\"",
3 : "SELECT c.FirstName, c.LastName, SUM(b.Unit_Price * od.Quantity) AS total_price FROM Books AS b INNER JOIN OrderDetails AS od ON b.BookID = od.BookID INNER JOIN Orders AS o ON o.OrderID = od.OrderID INNER JOIN Customers AS c ON o.CustomerID = c.CustomerID GROUP BY c.CustomerID HAVING total_price < 20",
4 : "SELECT b.Title, s.ShipperName FROM Books AS b INNER JOIN OrderDetails AS od ON od.BookID = b.BookID INNER JOIN Orders AS o ON o.OrderID = od.OrderID INNER JOIN Shippers AS s ON s.ShipperID = o.ShipperID WHERE o.ShippedDate = '08/04/10'",
5 : "SELECT b.Title FROM Books AS b INNER JOIN OrderDetails AS od ON od.BookID
#include <stdio.h>
struct FOO {
class_loader::class_loader_private::registerPlugin<A,B> &bar;
};
static FOO foo(baz);
int main(void) {
foo2.bar = 3;