Skip to content

Instantly share code, notes, and snippets.

View gshackles's full-sized avatar

Greg Shackles gshackles

View GitHub Profile
@mosquito
mosquito / README.md
Last active November 14, 2024 08:39
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@NickCraver
NickCraver / ExampleUsage.cs
Last active October 16, 2024 02:37
Code to mark a SQL string before it's passed to Dapper.
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
{
using (db.Connection.EnsureOpen())
{
try
{
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
}
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
{
public override void OnActivated (UIApplication application)
{
//When your app is backgrounded, iOS takes a snapshot.
//When the app comes back from the background it shows this snapshot at launch until your app is ready
//Sometimes apple forgets to remove the splash screen.
//Your app is in the forground and working. To prove it you can rotate, and see half your real screen.
//To prevent this from happening you can manually remove the view
foreach (var w in application.Windows) {
if (w != null && w != window) {
@kjeremy
kjeremy / MvxAppCompatSpinner.cs
Last active August 29, 2015 14:14
AppCompat-v22 Tinting for MvvmCross
/// <summary>
/// Tint-aware version of MvxSpinner so that it's styled properly
/// with AppCompat V21
/// </summary>
public class MvxAppCompatSpinner : MvxSpinner, ITintableBackgroundView
{
private static readonly int[] TintAttrs =
{
Android.Resource.Attribute.Background,
Android.Resource.Attribute.PopupBackground
@jonlipsky
jonlipsky / CustomAlertView.cs
Created August 12, 2014 05:38
CustomAlertView
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using System.Collections.Generic;
using System.Drawing;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreAnimation;
using System.Threading.Tasks;
/**
@tawman
tawman / commands.sh
Created November 14, 2013 21:36
Xamarin Studio and NuGet Package Restore
# /Users/todd/projects/SignalR/.nuget/nuget.targets: Error: Command 'mono --runtime=v4.0.30319 ../../.nuget/NuGet.exe install "packages.config" -source "https://nuget.org/api/v2/;http://www.myget.org/F/aspnetwebstacknightly/" -RequireConsent -solutionDir "../../" -nocache' exited with code: 1. (Microsoft.AspNet.SignalR.Client.Portable)
kvothe:Microsoft.AspNet.SignalR.Client.Portable todd$ mono --runtime=v4.0.30319 ../../.nuget/NuGet.exe install "packages.config" -source "https://nuget.org/api/v2/;http://www.myget.org/F/aspnetwebstacknightly/" -RequireConsent -solutionDir "../../" -nocache
Package restore is disabled by default. To give consent, open the Visual Studio Options dialog, click on Package Manager node and check 'Allow NuGet to download missing packages during build.' You can also give consent by setting the environment variable 'EnableNuGetPackageRestore' to 'true'.
kvothe:Microsoft.AspNet.SignalR.Client.Portable todd$ export EnableNuGetPackageRestore=true
kvothe:Microsoft.AspNet.SignalR.Cli
@Clancey
Clancey / BrightlyBlurredUIView
Last active December 24, 2015 14:59
A brightly colored iOS 7 UIBlurView
using System;
using MonoTouch.UIKit;
using MonoTouch.CoreAnimation;
public class BrightlyBlurredUIView: UIView
{
CALayer blurLayer,accentLayer;
UIView accentView;
UIToolbar toolbar;
public BrightlyBlurredUIView()
@praeclarum
praeclarum / Layout.cs
Created March 16, 2013 05:23
A C# syntax for NSLayoutConstraints.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.UIKit;
namespace Async.iOS
{
public static class Layout
{
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active November 5, 2024 18:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

var target = UIATarget.localTarget();
var window = UIATarget.localTarget().frontMostApp().mainWindow ();
var table = window.tableViews () [0];
var results_cell = table.cells () [0]
var run_cell = table.cells () [1];
var passed = false;
var results = '';
run_cell.tap ();