Skip to content

Instantly share code, notes, and snippets.

@danmiser
danmiser / github-clone-into-non-empty.md
Last active November 23, 2020 18:25 — forked from jweston491/github-clone-into-non-empty.md
Git clone into non-empty directory

Thanks to cmcginty from https://stackoverflow.com/questions/2411031/how-do-i-clone-into-a-non-empty-directory

Useful for if you have a local project directory that you want to re-sync with your git repo

git init
git remote add origin PATH/TO/REPO
git fetch
git reset origin/master  # Required when the versioned files existed in path before "git init" of this repo.
# git checkout -t origin/master # Original line, but gave me an error

git branch --set-upstream-to=origin/master

@danmiser
danmiser / gist:9894a60b8f43f0401265
Last active August 29, 2015 14:08
MonoTouch iOS8 not calling LoadView
// Recreate the home screen menu in case things have changed since the last sync
AppDelegate delegateReference = (AppDelegate)UIApplication.SharedApplication.Delegate;
// This if should always be true. Just being defensive to prevent crash shutdown if it's not
var viewControllers = delegateReference.rootNavigationController.ViewControllers;
if (viewControllers != null && viewControllers[0] is HomeScreen)
{
var homeScreen = (HomeScreen)viewControllers[0];
homeScreen.Root = homeScreen.CreateRoot();
// This line of code is needed in iOS8. It ends up triggering LoadView()
// https://gist.github.com/davidroth/1106927
// Licence: MIT X11
// Note: This is an Objective-C to C# translation by using code from: http://code.google.com/p/toast-notifications-ios/
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.ObjCRuntime;
using System;
@danmiser
danmiser / gist:1701803
Created January 30, 2012 01:25
ASP.NET MVC FormsAuthentication with ServiceStack
// Client code follows...
CookieContainer cookieContainer = new CookierContainer();
if (Login("user", "password"))
{
// Now we can use the ServiceStack classes to call the /api section
var client = new JsonServiceClient("http://localhost:8080/api");
client.CookieContainer = cookieContainer;
var request = new Sync {LastSync = DateTime.Now};
var response = client.Send<Sync>(request);
}
@danmiser
danmiser / gist:1657921
Created January 22, 2012 18:04
Update to ActionSheetDatePicker to set initial date to value in a text field
// Original code from: http://www.apress.com/9781430231745.
// Updated to deal with limitations explained here:
// http://www.distribucon.com/blog/ActionSheetDatePickerEnhancements.aspx
using System;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
namespace RoutExcel.Controls