Skip to content

Instantly share code, notes, and snippets.

#!/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 $*
# ----------------------------------------------------------------------------------
# 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
class UsersController < ApplicationController
respond_to :html, :xml
# GET /users
# GET /users.xml
def index
@users = User.all
respond_with(@users)
end
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)
=== 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 ===
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
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 {
/**
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
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
#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)