Skip to content

Instantly share code, notes, and snippets.

module PlacePop
# InstanceCache is a simple cache wrapper that gives any ActiveRecord object its own cache by automatically
# partitioning the given keys based on the class name and object id.
#
# InstanceCache implements a subset of the methods available to ActiveSupport::Cache::Store. If you require a method
# that is not already wrapped, it's easy to do it yourself.
#
# @example Write the user's star_count to users/1/star_count
# user = User.find(1)
# user.cache.write('star_count', 50)
# disabling CacheMoney as of 3/12/2009 to see how the site performs w/o
# such heavy-handed caching enabled
if (['staging', 'production'].include?(RAILS_ENV) || ENV['CACHEMONEY'] == 'true')
require 'cache_money'
config = YAML.load(IO.read(File.join(RAILS_ROOT, "config", "memcached.yml")))[RAILS_ENV]
$memcache = MemCache.new(config)
$memcache.servers = config['servers']
$local = Cash::Local.new($memcache)
class RequestLogger
def initialize(app)
@app = app
end
def call(env)
#if env.has_key?('HTTP_USER_AGENT') && env['HTTP_USER_AGENT'] =~ /iphone/i
req = Rack::Request.new(env)
File.open(log_path(ENV['RAILS_ENV']), 'a+') do |f|
function initDB(){
/* Get Sectors from session */
if(! isset($_SESSION['databaseURL'])){
include("conf/conf.php");
$dbConf = new DBConf();
$databaseURL = $dbConf->get_databaseURL();
$databaseUName = $dbConf->get_databaseUName();
$databasePWord = $dbConf->get_databasePWord();
$databaseName = $dbConf->get_databaseName();
public class NearbyActivity extends Activity {
private LocationManager locationManager;
private double lastKnownLatitude = new Double(-1);
private double lastKnownLongitude = new Double(-1);
private boolean debugGps = false;
private long gpsUpdateFrequency = 30000; // update frequency in milliseconds
private float gpsUpdateDistance = 10; // distance threshold in meters
public void onCreate(Bundle savedInstanceState) {
class ApplicationController < ActionController::Base
include Oink::InstanceTypeCounter # plugin: http://github.com/noahd1/oink
around_filter :capture_benchmarks
def capture_benchmarks
@benchmarks = []
yield
if @benchmarks.length > 0
private static class RegistrationTask extends AsyncTask<String, Void, Registration> {
private HttpPost httpPost;
private WeakReference<SignupActivity> mActivity;
private RegistrationForm mForm;
public RegistrationTask(SignupActivity activity, RegistrationForm form) {
super();
this.mActivity = new WeakReference<SignupActivity>(activity);
this.mForm = form;
TERMINAL 1
codyc@GDog:/var/www/learnror-cms.gdog$ /usr/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.0/bin/passenger start
=============== Phusion Passenger Standalone web server started ===============
PID file: /var/www/learnror-cms.gdog/tmp/pids/passenger.3000.pid
Log file: /var/www/learnror-cms.gdog/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
gary@gdog:/var/www$ sudo chown -R gary .
gary@gdog:/var/www$ ls -lah
total 16K
drwxr-xr-x 2 gary root 4.0K 2010-11-18 18:50 .
drwxr-xr-x 15 root root 4.0K 2010-11-18 18:47 ..
-rw-r--r-- 1 gary root 177 2010-11-18 18:47 index.html
-rw-r--r-- 1 gary root 20 2010-11-18 18:52 info.php
gary@gdog:/var/www$ rails new test.gdog
create
create README
6:08
cody
ok, how about now integrating an ORM with mysql.
6:09
Hacken
what did you have in mind?
6:09
cody