Skip to content

Instantly share code, notes, and snippets.

View samdelagarza's full-sized avatar

Sam De La Garza samdelagarza

View GitHub Profile
emptyOrder = {
TradeAction: 'buy',
AccountKey: 111,
AssetType: 'EQ',
Duration: null,
LimitPrice: null,
OrderID: null,
OrderType: 'Limit',
Quantity: null,
Route: null,
grunt.registerMultiTask('s3deploy', 'deploy to S3 using awssum', function () {
// dependencies
var awssum = require('awssum'),
fs = require('fs'),
path = require('path'),
aws = require('./settings').aws;
var amz = awssum.load('amazon/amazon'),
AmazonS3 = awssum.load('amazon/s3'),
s3 = new AmazonS3(aws.accessKey, aws.secretKey, aws.accountId , amz.US_EAST_1),

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@samdelagarza
samdelagarza / gist:4502452
Created January 10, 2013 14:33
rounding tick size
price - price % TickSize + ((price % TickSize < TickSize / 2) ? 0.0 : TickSize);
@samdelagarza
samdelagarza / gist:4497144
Created January 9, 2013 21:32
Underscore helpers
__without:function (list, othersList) {
var diff = _.chain(list)
.filter(function (item) {
return _.where(othersList,
{Name:item.Name}).length === 0;
})
.value();
return diff;
},
@samdelagarza
samdelagarza / cellUpdateBehavior.js
Created November 14, 2012 16:14
can this be made more performant?
define(['core', './topics'], function (core, topics) {
var valueFilter = /\D/g,
widthClasses = [], i,
jsLintLintDoesNotLikeLiteralsHere = true,
updateQueue = [],
pubsub = core.pubsub,
updatingInstances = {};
pubsub.subscribe(topics.pause, function (ev, instanceId) {
// delete to keep the object small, and keep the lookup time short.
require.config({
config: {
i18n: {
locale: myLocale
}
}
});
├───src
│ ├───client
│ │ ├───apps
│ │ │ ├───balance
│ │ │ │ └───tests
│ │ │ │ └───mocha
└────BalanceViewModel_spec.js
│ │ │ │ └───BalanceViewModel.js
└───tools
├───requirejs
var date = new Date();
date.toLocaleDateString().split(',')[1].trim().split(' ')[0];
@samdelagarza
samdelagarza / latency.txt
Created May 31, 2012 20:20 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns