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 get_course | |
course_params = params[:course] | |
Course.find_by_id(course_params[:id]) unless course_params.nil? | |
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 Api::ScheduledCoursesController < Api::BaseController | |
def create | |
@scheduled_course = ScheduledCourse.create!({ | |
course: get_course, | |
location: build_location | |
}) | |
render :create, status: :created | |
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 get_course | |
course_id = nil | |
course_id = params[:course][:id] if not params[:course].nil? and params[:course].has_key(:id) | |
Course.find_by_id(course_id) | |
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
ActiveSupport::Inflector.inflections do |inflect| | |
inflect.singular 'address', 'address' | |
inflect.plural 'address', 'addresses' | |
inflect.singular 'addresses', 'address' | |
inflect.plural 'addresses', 'addresses' | |
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
window.MyView = Backbone.View.extend({ | |
... | |
render: function() { | |
var html = My.Namespace.Templates.apply("template_name", new MyDisplayModel({ | |
model: this.model, | |
assHatOfTheWeek: "asshatting on alcohol at confs" | |
})); |
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
tamplates.js.coffee | |
---------------------- | |
class window.Templates | |
@templates = {} | |
@add: (name, template) -> | |
@templates[name] = template | |
@apply:(name, context) -> |
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
# updated solution | |
#in the view | |
= render :partial => "element", :collection => @elements | |
#in the partial | |
- if element_counter % 2 == 1 | |
.break | |
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
public int GetTotalStock(Guid ProductGuid) | |
{ | |
DataSet dsStock = new ProductsService().GetStockCount(ProductGuid); | |
if (dsStock.Tables != null) | |
{ | |
if (dsStock.Tables[0].Rows.Count > 0) | |
{ | |
if (dsStock.Tables[0].Rows[0]["TotalStock"] != null) | |
{ | |
return int.Parse(dsStock.Tables[0].Rows[0]["TotalStock"].ToString()); |
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
BUILD = { :Mode => 'Debug' } | |
require 'albacore' | |
require 'build/tasks.rb' | |
require 'fileutils' | |
task :default => [:debug] | |
task :debug => [:assemblyinfo, :set_debug_mode, :msbuild, :runtests] | |
task :release => [:assemblyinfo, :set_release_mode, :msbuild, :runtests, :publish, :pre_package_source, :package_source, :package_published] |
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 get_project_name | |
return ENV['TEAMCITY_PROJECT_NAME'].to_s unless ENV['TEAMCITY_PROJECT_NAME'].nil? | |
return "PROJECT_NAME_NOT_SET" | |
end | |
def get_version | |
buildnumber = ENV['BUILD_NUMBER'].to_s unless ENV['BUILD_NUMBER'].nil? | |
svnrevision = ENV['BUILD_VCS_NUMBER_' + SIMPLIFIED_VCS_NAME].to_s unless ENV['BUILD_VCS_NUMBER_' + SIMPLIFIED_VCS_NAME].nil? |
NewerOlder