Skip to content

Instantly share code, notes, and snippets.

View vongohren's full-sized avatar
⛓️

Snorre Lothar von Gohren Edwin vongohren

⛓️
View GitHub Profile
@vongohren
vongohren / app.js
Last active March 12, 2016 11:58
This is a simple node example of working with a client and showing info
var express = require('express');
var session = require('cookie-session');
var ApiClient = require('api-poc-client');
var request = require('superagent');
// SETUP
var app = module.exports = express();
var client = new ApiClient({
authServer: "https://id.sandbox.sparebank1.no",
clientId: "client-id-from-the-ID-portal",
@vongohren
vongohren / server.go
Last active March 11, 2016 12:12
A simpel oauth example go
package main
import (
"io"
"log"
"net/http"
"golang.org/x/oauth2"
"fmt"
"io/ioutil"
"github.com/bmizerany/pat"
@vongohren
vongohren / gist:4208f50b7c55c7b33ae8
Created February 3, 2015 10:09
selve chart optiosn
exports.createPlot = function(container, data, name) {
return chart1 = new Highcharts.Chart({
chart: {
renderTo: container,
zoomType: 'x'
},
title: {
text: name.charAt(0).toUpperCase() + name.substring(1)+'´s Moisture levels'
},
subtitle: {
var valueUpdated = function(snapshot) {
var name = this.props.name;
if(chart) {
var series = chart.series[0];
var x = Date.now();
series.addPoint([x, snapshot.val().watervalue], true, true)
}
}
componentDidMount: function() {
console.log(this.getDOMNode());
Highcharts.setOptions({
global: {
timezoneOffset: -1*60
}
})
var that = this;
var name = this.props.name;
initTokens: function() {
var _this = this;
_(this.splitAndTrim(this.$originalInput.val())).each(function(token) {
_this.tokens.add(token);
});
},
using System.Web.Mvc;
namespace BEKK_Radar.Web.Helpers.CustomFilters
{
public class CorsActionFilter : ActionFilterAttribute, IActionFilter
{
void IActionFilter.OnActionExecuting(ActionExecutingContext context)
{
if (context.HttpContext.Request.RequestType.Equals("POST")) return;
context.HttpContext.Response.AddHeader("Access-Control-Allow-Origin","*");
@vongohren
vongohren / gist:7845460
Created December 7, 2013 17:07
My DS component.xml
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="ModelFartSensorDriver">
<implementation class="model.fartsensor.ModelFartSensor"/>
<reference bind="setServerApi" cardinality="1..1" interface="ntnu.opcua.server.api.ServerApi" name="ServerApi" policy="static" unbind="unsetServerApi"/>
<reference bind="setFartSensor" cardinality="1..1" interface="hardware.driver.api.HardwareAPI" name="HardwareAPI" policy="static" target="(hardware=fartsensor)" unbind="unsetFartSensor"/>
<service>
<provide interface="org.osgi.service.event.EventHandler"/>
</service>
<property name="event.topics" value="ntnu/opcua/server/STARTED"/>
<reference bind="setNameSpaceController" cardinality="1..1" interface="ntnu.opcua.namespace.controller.api.NameSpaceControllerAPI" name="NameSpaceControllerAPI" policy="static" unbind="unsetNameSpaceController"/>
</scr:component>
@vongohren
vongohren / gist:7691718
Created November 28, 2013 13:19
OBJECT TYPE
fartSensorObjectFolder = new FolderType(fartSensorNodeManager, fartSensorObjectId, "FartSensorObject", Locale.ENGLISH);
//FOLDER FOR MY FARTSENSOR
fartSensorNodeManager.addNodeAndReference(objectsFolder, fartSensorObjectFolder, Identifiers.Organizes);
//FART SENSOR DEVEICE TYPE
final NodeId fartSensorTypeId = new NodeId(ns, "FartSensorType");
UaObjectType fartSensorType = new UaObjectTypeNode(fartSensorNodeManager, fartSensorTypeId, "FartSensorType", Locale.ENGLISH);
fartSensorNodeManager.addNodeAndReference(baseObjectsType, fartSensorType, Identifiers.HasSubtype);
@vongohren
vongohren / gist:7321546
Created November 5, 2013 16:17
example of a service.cfg file.
service.pid=ntnu.opcua.hardware.viperwim
hardware=viperWIM