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
# Add your own tasks in files placed in lib/tasks ending in .rake, | |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | |
require File.expand_path('../config/application', __FILE__) | |
Programme::Application.load_tasks | |
namespace :js do | |
task :test do | |
chdir 'client' do |
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 Bank::LuhnValidator | |
def self.valid_credit_card_number?(card_number) | |
valid = true | |
# Input requirements dictate that the card_number | |
# be numeric and that it be upto 19 characters | |
valid &= card_number.is_a?(Integer) && | |
(1..19).cover?(card_number.to_s.size) | |
valid &= luhn_valid?(card_number) |
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
Features are not specified | |
Error: Features are not specified | |
at getOptions (/Users/samwoodard/nest/store/frontend/nlstore/node_modules/ember-cli-defeatureify/index.js:45:11) | |
at Class.module.exports.included (/Users/samwoodard/nest/store/frontend/nlstore/node_modules/ember-cli-defeatureify/index.js:17:20) | |
at EmberApp.<anonymous> (/Users/samwoodard/nest/store/frontend/nlstore/node_modules/ember-cli/lib/broccoli/ember-app.js:312:15) | |
at Array.filter (native) | |
at EmberApp._notifyAddonIncluded (/Users/samwoodard/nest/store/frontend/nlstore/node_modules/ember-cli/lib/broccoli/ember-app.js:307:45) | |
at new EmberApp (/Users/samwoodard/nest/store/frontend/nlstore/node_modules/ember-cli/lib/broccoli/ember-app.js:103:8) | |
at Object.<anonymous> (/Users/samwoodard/nest/store/frontend/nlstore/Brocfile.js:5:11) | |
at Module._compile (module.js:460:26) |
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 value_for(resource, methods) | |
unless methods.is_a?(Array) | |
resource.respond_to?(methods) ? resource.send(methods) : '' | |
else | |
methods.inject(resource) {|resource, method| resource.respond_to?(method) ? resource.send(method) : ''} | |
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
$.fn.validatesNumericality = function(options) { | |
return this.each(function() { | |
var el = $(this); | |
// TODO: I18n | |
var thousandsSep = ','; | |
var decimalSep = '.'; | |
var settings = $.extend({ | |
invalidClass: 'invalid-numericality', | |
onlyInteger: false, |
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 () { | |
$ns('mnbb.global'); | |
var Util = mnbb.global.Util = function () { | |
var DECIMAL_SEP = '.'; | |
var THOUSANDS_SEP = ','; | |
function eachIsNumber (strs) { | |
for(var i = 0; i < strs.length; i++ ) { | |
if (isNaN(strs[i])) { |
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
NameError in Services#index | |
Showing app/views/layouts/application.html.erb where line #13 raised: | |
`@gbl_mast-head' is not allowed as an instance variable name | |
Extracted source (around line #13): | |
10: <%= yield :stylesheets %> | |
11: </head> |
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
ActionController::Routing::Routes.draw do |map| | |
# The priority is based upon order of creation: first created -> highest priority. | |
# Sample of regular route: | |
# map.connect 'products/:id', :controller => 'catalog', :action => 'view' | |
# Keep in mind you can assign values other than :controller and :action | |
# Sample of named route: | |
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' | |
# This route can be invoked with purchase_url(:id => product.id) |
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
# InventoryAdjustmentTransaction | |
def validate | |
return unless @item_id || !inventory_adjustment_entry.item | |
item = (self.inventory_adjustment_entry && self.inventory_adjustment_entry.item) || Item.find(@item_id) | |
if item.date_qty_falls_below_zero(inventory_adjustment_entry) | |
errors.add('item_qty', 'Cannot cause inventory qty to fall below zero.') | |
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
class MigrateCoaInventoryAndCogs < ActiveRecord::Migration | |
def self.up | |
Subscriber.all.each do |subscriber| | |
ApplicationGlobals.subscriber = subscriber | |
#Inventory Asset Account | |
inv_asset = Account.find_by_path("Inventory Asset") | |
if inv_asset && inv_asset.children.any? | |
inv_asset.update_attributes!(:name => 'Inventory Asset - Original') | |
inv_asset = nil | |
end |
OlderNewer