Skip to content

Instantly share code, notes, and snippets.

View ChaseFlorell's full-sized avatar
🇨🇦

Chase Florell ChaseFlorell

🇨🇦
View GitHub Profile
@ChaseFlorell
ChaseFlorell / GridView.cs
Last active August 6, 2017 23:53
Xamarin.Forms GridView
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace TimeTracker.Controls
{
public class GridView : Grid
function Add-Post {
param (
[parameter(Mandatory=$true, Position=0)][string]$post,
[parameter(Mandatory=$false, Position=1)][switch]$draft
)
if(!(Assert-IsGitRepo)) {
throw 'you are currently not in a git repository.'
}
@ChaseFlorell
ChaseFlorell / Get-FullName.ps1
Last active August 29, 2015 14:19
A slick way to do overloads in powershell.
function Get-FullName {
param(
[parameter(position=0, parametersetname="a")] [string] $firstName,
[parameter(position=1, parametersetname="a")] [string] $lastName,
[parameter(position=0, parametersetname="b")] [hashtable] $name
)
if($PSCmdlet.ParameterSetName -eq 'b') {
# Doing recursion will allow for parameter validation if need be!
Get-FullName $name.first $name.last
$apiKey = "Your API Key"
$OctopusURL = "Your Octopus URL"
$Header = @{ "X-Octopus-ApiKey" = $apiKey }
#Getting all machines given an Environment name
$EnvironmentName = Read-Host 'What environment do you want to wipe out?'
Write-Warning "You are about to remove ALL machines from the $EnvironmentName environment."
$confirm = Read-Host 'Are you sure you want to continue? Y/N'
@ChaseFlorell
ChaseFlorell / Add-ToPath.ps1
Created April 13, 2015 18:33
Add a path to your $env:PATH
function Add-ToPath{
param(
[parameter(Mandatory=$true,position=0)][string] $pathToAdd
)
if(-NOT ($env:path.Contains($pathToAdd)))
{
Write-Host "Adding '$pathToAdd' to your Environment Path."
$env:path += ";$pathToAdd"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $env:path
@ChaseFlorell
ChaseFlorell / Deploy-TeamCityBuildToOctopus.ps1
Last active September 5, 2020 08:48
a script for TeamCity to get git commits and pass them along to Octopus Deploy
# credit for getting me going in the right direction
# http://blogs.lessthandot.com/index.php/uncategorized/access-git-commits-during-a-teamcity-build-using-powershell/
# these properties should be entered into your configuration parameters section
$project = "%Octopus.Project%"
$deployTo = "%Octopus.DefaultEnvironment%"
$buildVersion = "%BuildVersion%"
$octopusApiKey = "%Octopus.BuildDeployBot.APIKey%"
$octopusServer = "%Octopus.Server.Url%"
@ChaseFlorell
ChaseFlorell / Namespace.js
Created October 28, 2014 14:48
Namespacing Javascript
// self executing function keeps code off of the global namespace.
(function() {
// initialize the namespace at the top of your very first code file.
var ns = {};
// begin declaring some classes
// This class is using the OBJECT LITERAL pattern
ns.Class1 = {
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace FutureState.AppCore.Pages
{
public class SegmentTab : ContentPage
{
private Grid _grid;
@ChaseFlorell
ChaseFlorell / App.cs
Last active August 29, 2015 14:04
This Gist is in response to the following Xamarin.Forms question: http://forums.xamarin.com/discussion/comment/68992/#Comment_68992
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace perfomance
{
@ChaseFlorell
ChaseFlorell / CustomPresenter.cs
Created May 23, 2014 03:51
Custom Presenter not showing appropriate ViewModel when calling `ViewModel.ShowViewModel<MyViewModel>();`
using System;
using Cirrious.CrossCore;
using Cirrious.MvvmCross.Binding.Touch.Views;
using Cirrious.MvvmCross.Touch.Views;
using Cirrious.MvvmCross.Touch.Views.Presenters;
using Cirrious.MvvmCross.ViewModels;
using FutureState.AppCore.ViewModels;
using FutureState.BreathingRoom.Touch.Ui.Controllers;
using FutureState.BreathingRoom.Touch.Ui.Fragments;
using MonoTouch.UIKit;