This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <signal.h> | |
#include <assert.h> | |
#define HISTORY_SIZE (1024*1024) | |
#define CHUNK_MIN (2*1024*1024) | |
#define CHUNK_MAX (32*1024*1024) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.unicorn_attr(*args) | |
args.each do |arg| | |
class << self | |
define_method(arg) do | |
@attributes[arg] | |
end | |
define_method("#{arg}=") do |value| | |
@attributes[arg] = value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get(path, params={}) | |
if parms[:memoize] | |
drivers[path] ||= value | |
else | |
driver.sc_object_for_property_path("#{abs_path}.#{Util.to_camel_case(path)}") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.objectify.adapters | |
import org.objectify.HttpMethod._ | |
import org.objectify.Action | |
import org.objectify.Objectify | |
import org.scalatra.servlet.ServletBase | |
trait ScalatraAdapter extends Objectify with ServletBase { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveRecord::Base | |
def destroy | |
unless new_record? | |
rows = connection.delete( | |
"DELETE FROM #{self.class.quoted_table_name} " + | |
"WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}", | |
"#{self.class.name} Destroy" | |
) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== avg diet before I started with this vegan shit === | |
breakfast: 2 eggs, yoghurt, juice | |
snack: smoothie with whatever frozen fruit we have around, juice, and whey protein | |
lunch: big bowl steamed broccoli and tofu, plain or with a bit of soy sauce | |
snack: almonds, peanuts, or whatever other nuts I have around + fruit | |
pre-workout carbs: whole wheat pasta with some pesto and parmesan | |
dinner: big salad: spinach, lettuce, chopped nuts, etc | |
=== workouts === |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mysql::Result | |
def each_utf8(&block) | |
each_orig do |row| | |
yield row.map {|col| String === col ? col.force_encoding("utf-8") : col } | |
end | |
end | |
alias each_orig each | |
alias each each_utf8 | |
def each_hash_utf8(&block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
respond_to :html, :xml | |
# GET /users | |
# GET /users.xml | |
def index | |
@users = User.all | |
respond_with(@users) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------------------------------------------------------------- | |
# Java installation | |
# ---------------------------------------------------------------------------------- | |
package "debconf-utils" do | |
action :install | |
end | |
# Java requires you to accept licenses by hand. We can automate this with the following script | |
bash "accept_licenses" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export RUBY_HEAP_MIN_SLOTS=500000 | |
export RUBY_HEAP_SLOTS_INCREMENT=250000 | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
export RUBY_GC_MALLOC_LIMIT=500000000 | |
/opt/ruby-enterprise/bin/ruby $* |
NewerOlder