Skip to content

Instantly share code, notes, and snippets.

View davidyang's full-sized avatar

david yang davidyang

View GitHub Profile
def initialize_framework_logging
for framework in ([ :active_record, :action_controller, :action_mailer ] & configuration.frameworks)
framework.to_s.camelize.constantize.const_get("Base").logger ||= Rails.logger
end
ActiveSupport::Dependencies.logger ||= Rails.logger
Rails.cache.logger ||= Rails.logger
end
class AuditLogger < Logger
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
end
end
[:action_controller, :active_record].each do |fw|
fw.to_s.camelize.constantize.const_get("Base").send(:define_method, :audit_log) do
@@audit_log ||= AuditLogger.new(File.open(File.join(RAILS_ROOT, 'log', "audit_#{RAILS_ENV}.log"), 'a'))
end
[default] Creating VM 'default'
[default] Provisioning enabled with Vagrant::Provisioners::ChefSolo
[default] Importing base VM (/Users/dyang/.vagrant/boxes/base/box.ovf)...
[default] Persisting the VM UUID (6b027c5c-e738-4289-8de5-befe87f382a9)...
[default] Matching MAC addresses...
[default] WARNING!
No guest additions were detected on the base box for this VM! Guest
additions are required for forwarded ports, shared folders, host only
networking, and more. If SSH fails on this machine, please install
the guest additions and repackage the box to continue.
# Moved here from Notifications, since we don't really need Visit to do it
def create_notifications
#eventually if we want to do multiple voice/email notifications, we should have
#some has_many relationship between query (or perhaps setting) and notification methods
# but for now just check all of them
NotificationMethod.all.each do |method|
nklass = Module.const_get(method.klass)
if self.send("#{method.short_name}_active?") # this maps to some functions in query
nklass.visits_needing_notification(self).each do |visit|
context "creates Visits and Patients" do
before(:all) do
ActiveRecord::Base.connection.begin_db_transaction
@query = Factory.create(:query)
@params = {}
@params[:practice_key] = @query.functionality.practice.subdomain_key
@params[:query_id] = @query.id
Visit.stub!(:strip_time_zone).and_return(Time.zone.now.tomorrow.to_s)
end
class nypl.ui.AccountView extends Backbone.View
initialize: =>
super
@template = nypl['myaccount']
@el = window.$('.ui-page-active')
@render()
events:
"click a" : "onSubmit"
@davidyang
davidyang / plugin.py
Created September 9, 2012 06:40
plugin.py
#!/usr/bin/env python
"""
Copyright 2011 William Dawson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
function Controller() {
require("alloy/controllers/BaseController").apply(this, Array.prototype.slice.call(arguments));
var $ = this, exports = {};
$.__views.dialerWindow = A$(Ti.UI.createWindow({
backgroundColor: "white",
id: "dialerWindow",
title: "Dialer",
navBarHidden: "true"
}), "Window", null), $.__views.phone = Alloy.createController("phone/phone", {
id: "phone"
@davidyang
davidyang / dialerTab.xml
Created September 9, 2012 17:26
Non-working Requires
<Alloy>
<Tab title="Dialer" icon="icons/dark_phone.png">
<Window id="dialerWindow" class="container" title="Dialer" navBarHidden="true">
<Require src="phone/phone" id="phone" />
</Window>
</Tab>
</Alloy>
@davidyang
davidyang / a.rb
Last active December 17, 2015 07:58
May 14 14:22:23 GMT 2013 tropo103.orl.voxeo.net PRISM 58560 5e984c0e42829264161c9b0deca69a05 5e984c0e42829264161c9b0deca69a05 1 0 #TROPO#: Thread http-0.0.0.0-8080-exec-9 returning engine after compiling script
May 14 14:22:23 GMT 2013 tropo103.orl.voxeo.net PRISM 58560 5e984c0e42829264161c9b0deca69a05 5e984c0e42829264161c9b0deca69a05 1 0 #TROPO#: Thread http-0.0.0.0-8080-exec-9 returned engine org.jruby.embed.jsr223.JRubyEngine@40c114d4 of type jruby, activeEngines = 61
May 14 14:22:23 GMT 2013 tropo103.orl.voxeo.net PRISM 58560 5e984c0e42829264161c9b0deca69a05 5e984c0e42829264161c9b0deca69a05 1 0 #TROPO#: In SimpleApplication.execute() for token launch, HttpSession hssn-470CE985D4C5A6B064372E080A87466F associated with SipApplicationSession sas_2-15-sm1svy0bb1wxzdgtropo
May 14 14:22:23 GMT 2013 tropo103.orl.voxeo.net PRISM 58560 5e984c0e42829264161c9b0deca69a05 5e984c0e42829264161c9b0deca69a05 1 0 #TROPO#: SipApplicationSession SipApplicationSessionImpl[_state=VALID, _id=sas_2-15-sm1svy0bb1wxzdgtropo, ] ass