Skip to content

Instantly share code, notes, and snippets.

public void DownloadAndReadMetadata(int imageId)
{
// Get scheduled image from db
var image = _context.ScheduledImages.Find(imageId);
// Download file
var stream = _downloader.Download(image.DownloadUrl);
// Read metadata
var metadata = _reader.ReadFromStream(stream);
public void Post([FromBody]AssetApiModel assetApiModel)
{
var imageMetadata = SaveScheduleImageEndity(assetApiModel); // Here we just save the entity to the db which should be a quick operation
_backgroundJobClient.Enqueue(() => helper.DownloadAndReadMetadata(imageMetadata.Id)); // The background job will grab the image's url from the db and then do its magic.
}
[assembly: OwinStartup(typeof(YourProject.Startup))]
namespace YourProject
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");
app.UseHangfireDashboard();
GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");
...
app.UseHangfireDashboard();
app.UseHangfireServer();
DivisionHelper = {};
DivisionHelper.parse = function (val) {
var operands = val.split('/');
return operands[0]/operands[1];
};
test("division_parse", function(assert) {
var result = DivisionHelper.parse('1/2');
assert.equal(result, 0.5)
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="http://{path-to-your-install}/qunit/qunit-1.15.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
var sequence = new ui.Sequence();
sequence.clear()
.do(this.mainTitleActor, this.showUpTween)
.at('+=150')
.do(this.subTitleActor, this.showUpTween)
.start();
var showUpTween = new ui.Tween({
values: {
y: 0,
opacity: 1
},
duration:600
});
var initialValues = {
y:40,
opacity:0
}
var mainTitleActor = new ui.Actor({
element: "#main-title",
values: initialValues
});