Skip to content

Instantly share code, notes, and snippets.

View bergquist's full-sized avatar
💻

Carl Bergquist bergquist

💻
View GitHub Profile
@bergquist
bergquist / gist:1284128
Created October 13, 2011 12:34
Merge into
merge into Customer.Address as Target
using Customer.AddressUpdates as Source
on Target.CustomerNumber=Source.CustomerNumber
when matched then
update set Target.FirstName = Source.FirstName,
Target.LastName = Source.LastName,
Target.StreetAddress = Source.StreetAddress,
Target.Email = Source.Email,
Target.IsVip = Source.IsVip,
Target.GroupRabat = Source.GroupRabat,
@bergquist
bergquist / gist:3550221
Created August 31, 2012 08:26
backbone mixin
var MyBackboneView = Backbone.View.extend({
....
});
var FormMixin = {
prop: '',
getFormValue: function(name) {}
}
_.extend(MyBackboneView.prototype, FormMixin);
function namespace(namespaceString) {
var parts = namespaceString.split('.'),
parent = window,
currentPart = '';
for (var i = 0, length = parts.length; i < length; i++) {
currentPart = parts[i];
parent[currentPart] = parent[currentPart] || {};
parent = parent[currentPart];
}
@bergquist
bergquist / gist:5107905
Created March 7, 2013 13:02
Render razorviews as strings.
using (var sw = new StringWriter()) {
ViewEngineResult viewEngineResult = ViewEngines.Engines.FindPartialView(controllerContext, viewName);
var viewContext = new ViewContext(controllerContext, viewEngineResult.View, viewData, new TempDataDictionary(), sw);
viewEngineResult.View.Render(viewContext, sw);
return sw.GetStringBuilder().ToString();
}
@bergquist
bergquist / .travis.yml
Last active January 3, 2016 16:29
kraken ci
language: node_js
node_js:
- '0.10'
script: ./ci.sh
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<add key="Password" value="ThisIsNotARealPassword" />
<add key="PublicKey" value="PgpPublicKey.asc" />
<add key="PrivateKeyOnly" value="PgpPrivateKeyOnly.asc" />
</configuration>
@bergquist
bergquist / app.js
Created November 19, 2015 11:46
danske-bank-trading
var inputs = [ 100, 99, 87, 77, 85, 99, 105, 110, 120, 110, 105, 100, 105, 100, 99, 95, 95, 95, 90, 89, 88, 80, 85, 87, 88, 89, 90, 95, 97, 100 ];
var history = []
var lastAction = ''
var shortSpan = 2;
var longSpan = 5;
inputs.forEach(function(el, position) {
history.push(el)
@bergquist
bergquist / app.js
Last active March 3, 2016 15:45
generic backend example
var express = require('express');
var bodyParser = require('body-parser');
var _ = require('lodash');
var app = express();
app.use(bodyParser.json());
var timeserie = [
{"target": "upper_25", "datapoints": [[3.0, 1450754160], [2.0, 1450754220], [1.0, 1450754280], [0.0, 1450754340], [1.0, 1450754400], [1.0, 1450754460], [1.0, 1450754520], [1.0, 1450754580], [1.0, 1450754640], [1.0, 1450754700], [2.0, 1450754760], [1.0, 1450754820], [165.0, 1450754880], [5.0, 1450754940], [1.0, 1450755000], [1.0, 1450755060], [5.0, 1450755120], [2.0, 1450755180], [2.0, 1450755240], [1.0, 1450755300], [1.0, 1450755360], [7.0, 1450755420], [4.0, 1450755480], [1.0, 1450755540], [7.0, 1450755600], [7.0, 1450755660], [1.0, 1450755720], [2.0, 1450755780], [1.0, 1450755840], [1.0, 1450755900], [2.0, 1450755960], [1.0, 1450756020], [1.0, 1450756080], [2.0, 1450756140], [1.0, 1450756200], [7.0, 1450756260], [2.0, 1450756320], [2.0, 1450756380], [1.0, 1450756440], [8.0, 1450756500], [7.0, 1450756560], [1.0, 1450756620], [2.0, 1450756
@bergquist
bergquist / grafana-cla-pie-panel.txt
Last active January 7, 2016 09:49
Grafana pie panel CLA
---
page_title: Grafana CLA
page_description: Grafana Contributor License Agreement
page_keywords: grafana, cla, contribute, documentation
---
# Grafana Contributor License Agreement
## Why is this agreement necessary?
We very much appreciate your wanting to contribute to Grafana,
/* global _ */
/*
* Complex scripted dashboard
* This script generates a dashboard object that Grafana can load. It also takes a number of user
* supplied URL parameters (in the ARGS variable)
*
* Return a dashboard object, or a function
*
* For async scripts, return a function, this function must take a single callback function as argument,