Skip to content

Instantly share code, notes, and snippets.

View mikebranstein's full-sized avatar

Mike Branstein mikebranstein

View GitHub Profile
@mikebranstein
mikebranstein / blank-app.c
Created September 8, 2017 15:37
Particle basic app
void setup() {
// configuration code goes here
}
void loop() {
// this code runs continually in a loop
// add your execution logic here
// delay pauses execution for 1000 milliseconds
delay(1000);
@mikebranstein
mikebranstein / ios-uinavigationbar-transparency.js
Created August 4, 2017 16:51
iOS UINavigationBar transparency in NativeScript
private initNavBarTransparency() {
if (topmost().ios) {
let navigationBar = topmost().ios.controller.navigationBar as UINavigationBar;
navigationBar.translucent = true;
navigationBar.setBackgroundImageForBarMetrics(UIImage.new(), UIBarMetrics.Default);
navigationBar.shadowImage = UIImage.new();
navigationBar.backgroundColor = UIColor.colorWithRedGreenBlueAlpha(0, 0, 0, 0.5);
}
}
<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
@mikebranstein
mikebranstein / Deploy-Appx.ps1
Created January 2, 2017 15:48
Upload APPX to Windows 10 IoT Core
param (
[string][Parameter(Mandatory = $false)] $DeviceName,
[string][Parameter(Mandatory = $false)] $TargetAppName,
[string][Parameter(Mandatory = $false)] $TargetAppPath,
[string][Parameter(Mandatory = $false)] $DeviceUsername,
[string][Parameter(Mandatory = $false)] $DevicePassword
)
$ErrorActionPreference = "Stop"
Add-Type -Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll"
@mikebranstein
mikebranstein / ns-stack-layout-example
Created December 13, 2016 13:44
NativeScript stack layout example
<StackLayout>
<Button text="Everything is awesome..." />
<Button text="when you’re using NativeScript!" />
</StackLayout>
@mikebranstein
mikebranstein / enable-iot-remote-server.ps1
Created September 2, 2016 13:31
Enable iot remote server on windows 10 iot core with powershell
Invoke-AuthenticatedWebRequest -uri "$apiRoot/iot/remote/enable" -userName $username -password $password -method "POST" -contentType ""
@mikebranstein
mikebranstein / Disable-SoftAP.ps1
Created September 1, 2016 22:37
Full code for disabling softAP on Windows 10 iot core with powershell
Param (
[string][Parameter(Mandatory = $true)] $deviceName
)
function Invoke-AuthenticatedWebRequest {
param (
[string] $uri,
[string] $userName,
[string] $password,
[string] $method,
@mikebranstein
mikebranstein / disable-softap.ps1
Created September 1, 2016 22:36
Disable SoftAP on Windows 10 IoT Core with REST API calls with powershell
$retryLimit = 10
$retryCount = 1
$noError = $false
while ($noError -eq $false -and $retryCount -le $retryLimit)
{
#Check for a 500 error on /api/iot/iotonboarding/softapsettings call
try{
$responseSoftAP = Invoke-AuthenticatedWebRequest -uri "$apiRoot/iot/iotonboarding/softapsettings" -userName $username -password $password -method "GET" -contentType ""
}
catch {
@mikebranstein
mikebranstein / authentication-web-request.ps1
Created September 1, 2016 22:23
make an web request using basic authentication in powershel
function Invoke-AuthenticatedWebRequest {
param (
[string] $uri,
[string] $userName,
[string] $password,
[string] $method,
[string] $contentType
)
$credentials = "$($userName):$($password)"
@mikebranstein
mikebranstein / set-time-zone.ps1
Created September 1, 2016 21:44
Set the time zone win windows 10 iot core with powershell
tzutil /s "Eastern Standard Time"