This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="../typings/mocha/mocha.d.ts" /> | |
/// <reference path="../StronglyTypedEvents.d.ts" /> | |
/// <reference path="../typings/node/node.d.ts" /> | |
/// <reference path="../typings/chai/chai.d.ts" /> | |
'use strict'; | |
var r = typeof require !== 'undefined', w = window as any; | |
var expect: Chai.ExpectStatic = r ? require('chai').expect : w.chai.expect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel.DataAnnotations; | |
using uPLibrary.Networking.M2Mqtt; | |
using uPLibrary.Networking.M2Mqtt.Messages; | |
var settings = AppSettingsProvider.Create<MqttSettings>(); | |
var port = Convert.ToInt32(settings.Port); | |
MqttClient client = null; | |
if (settings.UseSecureConnection) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// custom event polyfill for IE9 - IE11 | |
(function () { | |
if (typeof window.CustomEvent !== 'function') { | |
function CustomEvent(event, params) { | |
params = params || { bubbles: false, cancelable: false, detail: undefined }; | |
var evt = document.createEvent('CustomEvent'); | |
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); | |
return evt; | |
} | |
CustomEvent.prototype = window.Event.prototype; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"pomegranate": { | |
"50": "#f9ebea", | |
"100": "#f2d7d5", | |
"200": "#e6b0aa", | |
"300": "#d98880", | |
"400": "#cd6155", | |
"500": "#c0392b", | |
"600": "#a93226", | |
"700": "#922b21", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
ko.conditionedObservable = function (initialValue, condition) { | |
var obi = ko.observable(initialValue); | |
var computer = ko.computed({ | |
read: function () { return obi(); }, | |
write: function (newValue) { | |
//unwrap value - just to be sure | |
var v = ko.unwrap(newValue); | |
//check condition | |
if (condition(v)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
norrisUrl = 'https://api.icndb.com/jokes/random', | |
decode = require('decode-html'); | |
//the export is used to init the bot | |
module.exports = (robot) => { | |
//listen to phrases that contain "Norris" | |
robot.hear(/Norris/ig, (res) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parameter | |
{ | |
[FromRoute] | |
public string CategoryCode { get; set; } | |
[FromRoute] | |
public string ShopCode { get; set; } | |
[FromRoute] | |
public string SegmentCode { get; set; } | |
[FromRoute] | |
public string ProductId { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RegexNamedGroupRoutingConstraint : IRouteConstraint | |
{ | |
private readonly List<Regex> regexes = new List<Regex>(); | |
public RegexNamedGroupRoutingConstraint(params string[] regexes) | |
{ | |
foreach (var regex in regexes) | |
{ | |
this.regexes.Add(new Regex(regex)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.UseMvc(routes => | |
{ | |
var shopRoutingConstraint = new RegexNamedGroupRoutingConstraint( | |
"/(?<CategoryCode>[A-Z0-9]{3})_(?<ShopCode>[A-Z0-9]{3})_(?<SegmentCode>[A-Z0-9]{3})_(?<ProductId>\d+)/?$", | |
"/(?<CategoryCode>[A-Z0-9]{3})_(?<ShopCode>[A-Z0-9]{3})_(?<SegmentCode>[A-Z0-9]{3})/?$", | |
"/(?<CategoryCode>[A-Z0-9]{3})_(?<ShopCode>[A-Z0-9]{3})/?$", | |
"/(?<CategoryCode>[A-Z0-9]{3})/?$" | |
); | |
routes.MapRoute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { mapper, RestParameter } = require('hubot-command-mapper') | |
module.exports = robot => { | |
let todos = [] | |
mapper(robot, { | |
name: 'todo', | |
commands: [{ | |
name: 'add', | |
alias: [''], |
OlderNewer