Skip to content

Instantly share code, notes, and snippets.

View sononum's full-sized avatar

Ulrich Zurucker sononum

View GitHub Profile
@sononum
sononum / gist:6183139
Created August 8, 2013 09:26
accelerate Kaminari with Postgres insert into config/initializers/kaminari.rb
module Kaminari
module PageScopeMethods
def total_count
@_hacked_total_count || (@_hacked_total_count = self.connection.execute("SELECT (reltuples)::integer FROM pg_class r WHERE relkind = 'r' AND relname ='#{table_name}'").first["reltuples"].to_i)
end
end
end
all: detrand
detrand: main.c
cc -o detrand main.c -lssl -lcrypto
# Standard things
sp := $(sp).x
dirstack_$(sp) := $(d)
d := $(dir)
BUILDDIRS += $(BUILD_PATH)/$(d)
# Local flags
CXXFLAGS_$(d) := $(WIRISH_INCLUDES) $(LIBMAPLE_INCLUDES)
# Local rules and targets
class Mytree
attr_accessor :left, :right
attr_accessor :value
def initialize(v)
self.value = v
end
def print_preorder
print
#include <stdlib.h>
#include <stdio.h>
typedef struct _Tree {
char value;
struct _Tree* left;
struct _Tree* right;
} Tree;
Tree * newTree(char v) {