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
myAjaxFunction: function(attributes, callback) { | |
if ($.browser.msie && window.XDomainRequest && parseInt($.browser.version) <= 9) { | |
var xdr = new XDomainRequest(); | |
xdr.open('POST', 'URL', true); | |
xdr.send(attributes); | |
xdr.onload = function() { | |
callback(JSON.parse(xdr.responseText)); | |
} | |
} else { | |
$.ajax({ |
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
<?php | |
/* Setup Eloquent. */ | |
use Illuminate\Database\Capsule\Manager as Capsule; | |
use Illuminate\Events\Dispatcher; | |
use Illuminate\Container\Container; | |
$capsule = new Capsule; | |
$capsule->addConnection([ | |
"driver" => "mysql", |
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
/** | |
* Validator Class | |
*/ | |
define([ | |
'jquery', | |
'underscore' | |
], function($, _){ | |
var Validator = { |
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
define([ | |
'jquery', | |
'underscore' | |
], function ($, _) { | |
var ImageHelper = { | |
initialize: function () { | |
var example = [ | |
"img/image1.jpg", | |
"img/image2.jpg" |
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 total = 0; | |
for (var key in localStorage) { | |
var keySize = ((localStorage[key].length * 2) / 1024 / 1024).toFixed(2); | |
console.log(key + '=' + keySize + ' MB'); | |
total += parseFloat(keySize); | |
} | |
console.log('total=' + total.toFixed(2) + ' MB'); |
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
define([ | |
'underscore', | |
'backbone' | |
], function (_, Backbone) { | |
var Singleton = Backbone.Model.extend({ | |
}, { | |
singleton: null, |
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
// Helper service to paginate an array | |
// Usage: | |
// var bigArray = [1, 2, 3, ..., 1000], | |
// paginatedArray = new ArrayPaginator(bigArray); | |
// paginatedArray.getFirstPage() <-- will always return the first 10 elements in array | |
// paginatedArray.getNextPage() <-- will return next 10 elements in array of the next page | |
/*global define*/ | |
define([], function() { | |
'use strict'; |
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
/** | |
* Handlebars helper to transform a time stamp ms to a nicely | |
* formatted "31 minutes ago", "1 hour ago" type date. | |
*/ | |
Handlebars.registerHelper('beautify_date', function(options) { | |
var timeAgo = new Date(parseInt(options.fn(this))); | |
if (Object.prototype.toString.call(timeAgo) === '[object Date]') { | |
if (isNaN(timeAgo.getTime())) { | |
return 'Not Valid'; | |
} else { |
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
Given(/^I am logged in as a salesman assigned to "(.*?)", with the following products:$/) do |client, table| | |
salesman = Support::Salesman.find_or_create | |
client = Support::Client.new(client) | |
Support::Salesman.assign_client(client) | |
Support::Product.assign_products(salesman, table.hashes) | |
LoginPage.visit.login(salesman) | |
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
Feature: Create an Order | |
Ubiqua allows salesmen to order products for their clients. | |
Scenario: Order Some Products | |
Given I am logged in as a salesman assigned to "Farmacia Moreno", with the following products: | |
| product_name | price | | |
| Caja Gatorade | 1.00 | | |
| Botella Agua | 2.00 | | |
When I send an order for client "Farmacia Moreno" with the following products: |
OlderNewer