Skip to content

Instantly share code, notes, and snippets.

@VladimirAkopyan
VladimirAkopyan / VisualStudio Code Remote attach
Created June 8, 2018 13:02
VisualStudio Code Remote attach and debug
{
"name": ".NET Core Remote Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickRemoteProcess}",
"pipeTransport":
{
"debuggerPath": "~/vsdbg/vsdbg",
"pipeCwd": "${workspaceFolder}",
@VladimirAkopyan
VladimirAkopyan / FuncOnMatch.cs
Last active December 25, 2017 21:09
Two lists, execute function on ItemMatch.
using System;
using System.Collections.Generic;
using System.Linq;
namespace ListFunc
{
class Program
{
static void Main(string[] args)
{
@VladimirAkopyan
VladimirAkopyan / BindingDepth.cs
Last active December 21, 2017 19:44
Demonstrates the difference between deep and shallow bindings for XAML / UMP / WPF
// Let's consider two objects, declared elsewhere
var viewModel = ViewmModel;
var car = ViewModel.Car;
//now let's crate a shallow Binding
Binding shallowBinding = new Binding();
shallowBinding.Source = ViewModel.Car;
shallowBinding.Path = new PropertyPath(nameof(car.Name)”);
shallowBinding.Mode = BindingMode.OneWay;
@VladimirAkopyan
VladimirAkopyan / ListCast.cs
Last active December 22, 2017 01:20
Perform and operation on an entire list of objects in C#/ In this case, casts an entire list of objects into different ones
List<float> floatList= intList.Select(r => r as float).ToList();
@VladimirAkopyan
VladimirAkopyan / Project.json
Last active December 29, 2016 13:07
.Net Core v1.1 project.json that's setup correctly.
{
"dependencies": {
"Microsoft.NETCore.App": "1.1.0"
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"netcoreapp1.1"
]
@VladimirAkopyan
VladimirAkopyan / ReadingsToEdison.ino
Created December 3, 2016 04:24
Sends sensor readings to intel edison
#include <ArduinoJson.h>
#include <DallasTemperature.h>
#include <DHT.h>
//Let's say we have some DHT sensors
#define DHTPIN 2
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
//And let's say we've got DS18B20
@VladimirAkopyan
VladimirAkopyan / Ph_Probe_Cooking-hacks.cpp
Created October 23, 2016 00:28
Reading PH probes using Hydroponics board from cooking-hacks
#ifndef _SENSORPH_h
#define _SENSORPH_h
#define calibration_point_4 2560 //Write here your measured value in mV of pH 4
#define calibration_point_7 2363 //Write here your measured value in mV of pH 7
#define calibration_point_10 2168 //Write here your measured value in mV of pH 10
@VladimirAkopyan
VladimirAkopyan / Cooking-hacks_EC_Probe.cpp
Last active October 23, 2016 00:25
Reading EC probes using Hydroponics board from cooking-hacks
// SensorEC.h
#ifndef _SENSOREC_h
#define _SENSOREC_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
@VladimirAkopyan
VladimirAkopyan / WPFBinding.xaml
Created July 28, 2016 17:02
WPF bindings - settings data context to self, and using it in Label. Obv. corresponding field must exists in MainWindow.Xaml.cs
<Window x:Class="MapDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MapDemo"
mc:Ignorable="d"
Title="MainWindow" Height="720" Width="1280" MinWidth="1282" MinHeight="720" MaxWidth="1280" MaxHeight="720"
DataContext="{Binding RelativeSource={RelativeSource Self}}">