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
# using after_save (this works) | |
class GameObserver < ActiveRecord::Observer | |
observe :game | |
def after_save(game) | |
game.record_win_or_tie | |
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
def self.update_rank_by klass | |
rank_class = (klass.name + "Rank").constantize | |
rank_by_col = "#{klass.name.underscore}_id".to_sym | |
rank = total_points = rank_by = 0 | |
sum_points_by(rank_class, rank_by_col).find_in_batches do |points| | |
User.transaction do | |
points.each do |point| | |
rank_by_col_val = point.send(rank_by_col) |
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.update_rank_by klass | |
rank_class = (klass.name + "Rank").constantize | |
rank_by_col = "#{klass.name.underscore}_id".to_sym | |
select_sql = "points.user_id, points.#{rank_by_col}, | |
SUM(points.points) total_points" | |
rank = total_points = 0 | |
Point.select(select_sql).group(:user_id, rank_by_col). | |
order("total_points DESC").find_in_batches do |points| | |
User.transaction do | |
points.each do |point| |
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
bitnami@domU-12-31-39-10-49-24:~$ ps aux | |
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND | |
root 1 0.0 0.2 3540 1736 ? Ss Feb28 0:00 /sbin/init | |
root 2 0.0 0.0 0 0 ? S Feb28 0:00 [kthreadd] | |
root 3 0.0 0.0 0 0 ? S Feb28 0:06 [ksoftirqd/0] | |
root 4 0.0 0.0 0 0 ? S Feb28 0:28 [kworker/0:0] | |
root 5 0.0 0.0 0 0 ? S Feb28 0:00 [kworker/u:0] | |
root 6 0.0 0.0 0 0 ? S Feb28 0:00 [migration/0] | |
root 7 0.0 0.0 0 0 ? S Feb28 0:08 [watchdog/0] | |
root 8 0.0 0.0 0 0 ? S< Feb28 0:00 [cpuset] |
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
# | |
ServerRoot "/opt/bitnami/apache2" | |
# | |
# Listen: Allows you to bind Apache to specific IP addresses and/or | |
# ports, instead of the default. See also the <VirtualHost> | |
# directive. | |
# | |
# Change this to Listen on specific IP addresses as shown below to | |
# prevent Apache from glomming onto all bound IP addresses. |
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
mkdir -p ext/common/libboost_oxt | |
g++ -Iext -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" -DHASH _NAMESPACE="__gnu_cxx" -DHASH_FUN_H="<hash_fun.h>" -DHAS_ALLOCA_H -DHAS_SFENCE - DHAS_LFENCE -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -g -DPASSENGER_D EBUG -DBOOST_DISABLE_ASSERTS -o ext/common/libboost_oxt/aggregate.o -c ext/commo n/libboost_oxt/aggregate.cpp | |
In file included from ext/boost/src/pthread/thread.cpp:27:0, | |
from ext/common/libboost_oxt/aggregate.cpp:6: | |
ext/boost/src/pthread/timeconv.inl: In function âvoid |
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
Sent mail to test@example.com (976ms) | |
Date: Mon, 21 May 2012 17:46:03 -0700 | |
From: Foo <info@Foo.com> | |
To: Test <test@example.com> | |
Message-ID: <4fbae1cd97173_147836a9bc5679f@MININT-4LBRRLS.mail> | |
Subject: Welcome to Foo, Test! |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="Copyright" content="Copyright (c) 2012 foo" /> | |
<title>bar Dashboard</title> | |
<link href="/assets/bootstrap-27d6ee163b1ec85218082bd3ffe36e97.css" media="screen" rel="stylesheet" type="text/css" /> | |
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css" media="screen" rel="stylesheet" type="text/css" /> |