Skip to content

Instantly share code, notes, and snippets.

View sdanna's full-sized avatar

Steven D'Anna sdanna

View GitHub Profile
var theAnswer = Config.Global.Get<int>("MyInteger"); // 42
@sdanna
sdanna / web.csx
Last active November 12, 2015 22:36
Add("MyInteger",42);
task Publish -depends Compile {
Remove-Item $build_dir -Recurse -Force -ErrorAction SilentlyContinue #Cleanup the build directory
exec {
msbuild $source_dir\$project_name.sln /property:DeployOnBuild=true /property:PublishProfile=$project_config /property:UserName=<IISManagerUserName> /property:Password=<IISManagerUserPassword> /property:AllowUntrustedCertificate=true /v:q /nologo /clp:ErrorsOnly
}
}
@sdanna
sdanna / DbFixture
Last active November 5, 2019 09:12
using System;
using System.IO;
using Zomg.DAL;
namespace IntegrationTests.Fixtures
{
public class DbFixture<T> : IDisposable
{
private readonly string _connectionString;
private static Checkpoint _checkpoint = new Checkpoint
using System.Linq;
using IntegrationTests.Fixtures;
using Xunit;
using Zomg.Features.Company;
namespace IntegrationTests.Features.Company
{
public class CreateHandlerTests
{
[Collection("IntegrationTests.Features.Company.CreateHandlerTests")]
using System;
using System.IO;
using Zomg.DAL;
namespace IntegrationTests.Fixtures
{
public class DbFixture<T> : IDisposable
{
private readonly string _connectionString;
public ApplicationDbContext Context { get; private set; }
@sdanna
sdanna / AddEntryActivity.java
Created October 21, 2015 21:30
Time Formatting
String.format("%d:%2s", get12HourFormat(hourOfDay), minute).replace(' ', '0') + getAmPm(hourOfDay)
@sdanna
sdanna / AddEntryActivity.java
Created October 21, 2015 21:27
Helper Functions for Time formatting
private String getAmPm(int hourOfDay) {
return (hourOfDay >= 12) ? "PM" : "AM";
}
private int get12HourFormat(int hourOfDay) {
if (hourOfDay == 0) return 12;
return (hourOfDay <= 12) ? hourOfDay : hourOfDay - 12;
}
@sdanna
sdanna / AddEntryActivity.java
Created October 21, 2015 21:21
Time Pickers
private void setTimeFields(){
startTime.setOnClickListener(this);
endTime.setOnClickListener(this);
Calendar currentTime = Calendar.getInstance();
int hour = currentTime.get(Calendar.HOUR_OF_DAY);
int minute = currentTime.get(Calendar.MINUTE);
startTimePickerDialog = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {
@Override
@Override
public void onClick(View view) {
if (view == entryDate){
datePickerDialog.show();
}
}