Skip to content

Instantly share code, notes, and snippets.

(
var activenotes = nil!128; //make Array of 128 slots, initially with nil objects in to represent nothing
var releasefunction = {|index|
//release existing note if present already
if(activenotes[index].notNil) {
activenotes[index].release; //will send gate=0
activenotes[index] = nil; //make sure now empty slot ready
}
};
<body ng-controller="myCtl">
<input type="button" ng-click="showConfirm()" value="Show" />
<div my-confirm visible="confirmVisible" confirm-content="{{confirmMessage}}" confirm-title="Confirm Dialog Demo" confirm-positive="doThing()"></div>
</body>
.controller('myCtl', function ($scope) {
$scope.showConfirm = function() {
$scope.confirmMessage = 'Are you sure you want to?';
$scope.confirmVisible = true;
};
$scope.doThing = function() {
console.log('do something that requires confirmation');
};
})
.directive('myConfirm', function () {
function link($scope) {
$scope.visible = false;
$scope.posClick = function() {
$scope.visible = false;
$scope.confirmPositive();
};
}
return {
template: '<div class="mydialog-bg" ng-show="visible"><div class="mydialog-pop"><div class="mydialog-title">{{confirmTitle}}</div><div>{{confirmContent}}</div><input type="button" ng-click="posClick()" value="OK" /><input type="button" ng-click="visible=false" value="Cancel" /></div></div>',
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<style>
body {
font-family: arial;
}
.mydialog-bg {
background-color: rgba(100, 100, 100, 0.8);
width: 100%;
.controller('myCtl', function ($scope) {
$scope.showAlert = function() {
$scope.alertMessage = 'This is my alert message!';
$scope.alertVisible = true;
}
})
<body ng-controller="myCtl">
<input type="button" ng-click="showAlert()" value="Show" />
<div my-alert visible="alertVisible" alert-content="{{alertMessage}}" alert-title="Alert Dialog Demo"></div>
</body>
.directive('myAlert', function () {
return {
template: '<div class="mydialog-bg" ng-show="visible"><div class="mydialog-pop"><div class="mydialog-title">{{alertTitle}}</div><div>{{alertContent}}</div><input type="button" ng-click="visible=false" value="OK" /></div></div>',
link: function(scope) { scope.visible = false;},
scope: {
alertTitle: '@',
alertContent: '@',
visible: '='
}
};
namespace MyNameSpace
{
public class MyServices : WebService, IMyContract
{
public void UpdateItem(BaseRequest req, string itemID)
{
if (req is DerivedClass)
{
// do something with derrived class
}
namespace MyNameSpace
{
[DataContract]
[KnownType(typeof(DerivedClass))]
public class BaseRequest
{
[DataMember]
public int ID;
}