Skip to content

Instantly share code, notes, and snippets.

@yavor87
yavor87 / androidPlayAudio.java
Last active August 3, 2023 21:40
Record, play and visualize raw audio data in Android
ShortBuffer mSamples; // the samples to play
int mNumSamples; // number of samples to play
void playAudio() {
new Thread(new Runnable() {
@Override
public void run() {
int bufferSize = AudioTrack.getMinBufferSize(SAMPLE_RATE, AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_16BIT);
if (bufferSize == AudioTrack.ERROR || bufferSize == AudioTrack.ERROR_BAD_VALUE) {
@yavor87
yavor87 / buttonBlink.ino
Last active February 7, 2016 13:08
Example for TI MSP40 board. Will blink button on specific frequency depending on button presses.
@yavor87
yavor87 / ESP8266.ino
Last active May 21, 2016 09:58
ESP8266 sensor server
#include <DHT.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#define DHTPIN 2
#define DHTTYPE DHT11
#define LEDPIN 14
ESP8266WebServer server(80);
DHT dht(DHTPIN, DHTTYPE);
@yavor87
yavor87 / CustomAction.cs
Last active October 25, 2020 17:32
Wix Embedded Sqlite
public class CustomActions
{
[CustomAction]
public static ActionResult BuildIndex(Session session)
{
session.Log("Begin building index");
try
{
EmbeddedAssembly.Load(string.Format("BuildIndexAction.{0}.SQLite.Interop.dll", Environment.Is64BitProcess ? "x64" : "x86"), "SQLite.Interop.dll");
<Application>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Data.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.GridView.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Input.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
public class MainViewModel : ViewModelBase
{
private ObservableCollection<Employee> _data;
public ObservableCollection<Employee> Data
{
get => _data;
set
{
if (_data == value)
public class MainViewModel : ViewModelBase
{
public MainViewModel(IEmployeeService employeeService)
{
IQueryable query = _employeeService.GetEmployees();
this.Employees = new Telerik.Windows.Data.VirtualQueryableCollectionView(query) { LoadSize = 20 };
}
public Telerik.Windows.Data.VirtualQueryableCollectionView Employees { get; }
}
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type telerik:GridViewCell}" BasedOn="{StaticResource GridViewCellStyle}">
<Setter Property="Background" Value="#ffcc00"/>
</Style>
<Style TargetType="{x:Type telerik:GridViewHeaderCell}" BasedOn="{StaticResource GridViewHeaderCellStyle}">
<Setter Property="Background" Value="LimeGreen"/>
<Setter Property="Foreground" Value="Cyan"/>
</Style>
</Grid.Resources>
<ContentPage xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
Title="Contoso">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Menu" Clicked="OpenPopup" />
</ContentPage.ToolbarItems>
<telerikPrimitives:RadPopup.Popup>
<telerikPrimitives:RadPopup x:Name="popup" IsModal="false" Placement="Right"
VerticalOffset="10" OutsideBackgroundColor="#6F000000">
<ContentView
<ContentView.ControlTemplate>
<ControlTemplate>
<telerikPrimitives:RadBorder CornerRadius="2" BackgroundColor="{TemplateBinding BackgroundColor}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>