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
var Mammal = function(name) { | |
this.name = name; | |
this.offspring = []; | |
}; | |
Mammal.prototype.sayHello = function() { | |
return "My name is " + this.name + ", I'm a Mammal"; | |
}; | |
Mammal.prototype.haveBaby = function() { |
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
var StudentDaySchema = new Schema({ | |
user: { | |
name: {type: String} | |
}, | |
date: {type: Date, default: Date.now}, | |
attendance: { | |
status: {type: String}, | |
comments: {type: String} | |
}, | |
helpTickets: [{ |
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 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 |
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 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 |
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
[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. |
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
# 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| |
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
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 |
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 nypl.ui.AccountView extends Backbone.View | |
initialize: => | |
super | |
@template = nypl['myaccount'] | |
@el = window.$('.ui-page-active') | |
@render() | |
events: | |
"click a" : "onSubmit" |
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
#!/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 |
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
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" |
OlderNewer