Skip to content

Instantly share code, notes, and snippets.

View JamieDixon's full-sized avatar

Jamie Dixon JamieDixon

View GitHub Profile
@JamieDixon
JamieDixon / fontell-svg-path
Created November 3, 2014 11:17
Fontello - SVG with path
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="17.553" height="14.978"
viewBox="-1.321 -0.015 17.553 14.978" overflow="visible" enable-background="new -1.321 -0.015 17.553 14.978"
xml:space="preserve">
<path fill="#40E2A0" d="M15.998,14.727L7.504,0.204l-8.486,14.521L15.998,14.727z M7.48,4.057l4.889,8.569H2.637L7.48,4.057z"/>
var curry = function curry(func) {
return function inner(func, item) {
func = func.bind(func, item);
return func.length < 1 ? func.call(func) : inner.bind(null, func);
}.bind(null, func);
};
// Some example usages
var ilike = curry(function ilike(a, b, c, d) { console.log("I like ", a, b, c, d); }),
module.exports = function map(fn, items) {
items = items.slice();
return items.length === 0 ? items : items.length === 1 ? [fn(items.shift())] : [].concat(fn(items.shift()), map(fn, items));
};
Ly8gTWVtb3J5IE1hbmFnZXINCg0KZnVuY3Rpb24gTWVtb3J5TWFuYWdlcihtZW1vcnkpIHsNCiAgdmFyIGkgPSBtZW1vcnkubGVuZ3RoIC0gMTsNCiAgd2hpbGUgKGkgPiAtMSkgew0KICAgIG1lbW9yeVtpXSA9IG1lbW9yeVtpXSB8fCBudWxsOw0KICAgIGktLTsNCiAgfQ0KDQogIHRoaXMuYWxsb2NhdGVkID0ge307DQogIHRoaXMubWVtb3J5ID0gbWVtb3J5Ow0KfQ0KDQpmdW5jdGlvbiBpc0FsbG9jYXRlZChwb2ludGVyKSB7DQogIHJldHVybiBwb2ludGVyIGluIHRoaXMuYWxsb2NhdGVkOw0KfQ0KDQpmdW5jdGlvbiBzZXRBbGxvY2F0aW9uKHN0YXJ0LCBzaXplKSB7DQogIHZhciBlbmQgPSAoc3RhcnQgKyBzaXplKSAtIDE7DQogIHdoaWxlIChlbmQgPj0gc3RhcnQpIHsNCiAgICB0aGlzLmFsbG9jYXRlZFtlbmRdID0gZW5kID09PSBzdGFydCA/IHsNCiAgICAgIHN0YXJ0OiBzdGFydCwNCiAgICAgIHNpemU6IHNpemUNCiAgICB9IDogdW5kZWZpbmVkOw0KICAgIGVuZC0tOw0KICB9DQp9DQoNCk1lbW9yeU1hbmFnZXIucHJvdG90eXBlLmFsbG9jYXRlID0gZnVuY3Rpb24oc2l6ZSkgew0KICB2YXIgaXNGcmVlID0gZmFsc2UsDQogICAgbmV4dEZyZWVCbG9ja1N0YXJ0SW5kZXggPSAtMSwNCiAgICBpID0gMCwNCiAgICBqOw0KDQogIGlmICh0aGlzLm1lbW9yeS5sZW5ndGggPCBzaXplIHx8IHRoaXMubWVtb3J5Lmxlbmd0aCAtIE9iamVjdC5rZXlzKHRoaXMuYWxsb2NhdGVkKS5sZW5ndGggPCBzaXplKSB7DQogICAgdGhyb3cgIkNhbm5vdCBhbGxv
public class SomeEntitySource {
public string BillToName {get;set;}
public string BillToAdress1{ get;set;}
... 10 more properties
public string ShipToName{ get; set; }
public string ShipToAddress1 {get; set; }
... 10 more properties
... 3 further variants on the above.
@JamieDixon
JamieDixon / gist:7648e3d52c7ba7b9527b
Last active August 29, 2015 14:22
Ordering by arbitrary array - Not ordering by any item in the ordered collection
// Doesn't work
var bookmarkedProductIds = this._userBookmarkedProductsQuery.Invoke().ToList();
var result = client.Search<Product>(s => s
.Skip(request.Skip)
.Take(request.Take)
.SortAscending(p => bookmarkedProductIds.IndexOf(p.Id))
.Query(request.Query));
function foo() {
var i = 1;
return function bar(count = i) {
return i;
}
}
const compose = function (...args) {
return function operate(data, i = args.length-1) {
return i === 0 ? args[0](data) : operate(args[i](data), i - 1);
}
};
// Another option could be to track the values and count using two arrays.
// Here we set the initial length of counter to the length of the incoming args
// Each iteration we pop an item, reducing the length of the counter by 1.
var compose = function (...args) {
return function (data) {
const out = [];
const counter = new Array(args.length);
while(counter.length >= 1) {
- User's browser connects to SignalR Hub on server.
- Hub keeps ticking over (System.Threading.Timer) and checks a Queue for updates that happen during a long running process.
- When a message is on the queue we look at the message body to see if this is the item we're currently tracking.
If it is hit DynamoDB for a progress report and broadcast the changes to the client.