Skip to content

Instantly share code, notes, and snippets.

View xinmyname's full-sized avatar

Andy Sherwood xinmyname

View GitHub Profile
@xinmyname
xinmyname / git-status-recursive.sh
Last active April 5, 2018 17:07 — forked from gpolitis/git-status-recursive.sh
Recursive git status
#!/bin/sh -e
find . -name .git -type d | while read dir; do repo=$(dirname $dir); echo $repo; git -C $repo status --short --branch; echo ""; done
@xinmyname
xinmyname / gitstatusall.ps1
Created July 3, 2017 23:11
Powershell recursive git status
gci -r -fo -fi .git |% { $g = $_.Fullname; $r = $g.Substring(0,$g.Length-5); Write-Host($r); git -C $r status --porcelain --branch }
@xinmyname
xinmyname / something.csproj
Created March 8, 2017 00:24
.csproj with runtime identifier building exe with embedded resource
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<RuntimeIdentifiers>win7-x86;win10-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<None Remove="TextFile1.txt" />
@xinmyname
xinmyname / NSURLSessionExtension.swift
Created May 4, 2016 16:09
My extensions to NSURLSession that handle data/text/json and throw exceptions
extension NSURLSession {
enum UTF8Encoding : ErrorType { case Error }
enum JsonDecoding : ErrorType { case Error }
func dataForRequest(request:NSURLRequest, completeWith: (dataResult: () throws -> NSData) -> Void) {
let task = self.dataTaskWithRequest(request) { (data:NSData?, response:NSURLResponse?, error:NSError?) in
guard let data = data else {
@xinmyname
xinmyname / LogIntercepter.cs
Created September 21, 2015 16:45
log4net logging interceptor
using System;
using System.Collections.Generic;
using log4net;
namespace Infrastructure
{
public interface IInterceptLogs
{
IList<string> Lines { get; }
IList<Exception> Exceptions { get; }
@xinmyname
xinmyname / SetDiff.cs
Last active August 29, 2015 14:25
C# Set Diffs
using System;
using System.Collections.Generic;
namespace HashSetTest
{
class Program
{
static void Main()
{
var curSet = new[] {"A","B","C","D","E"};
@xinmyname
xinmyname / deserializeWCFDateString.swift
Created February 27, 2015 18:28
Deserialize WCF Date
import Foundation
func deserializeWCFDateString(json:AnyObject?) -> NSDate? {
if let jsonDateString = json as? String {
if countElements(jsonDateString) < 18 {
return nil
}
@xinmyname
xinmyname / LoadDefaults.swift
Last active August 29, 2015 14:16
Register user defaults from Settings.bundle in Swift v1.0
//
// Loads the DefaultValue for each preference specifier with a Key in your Settings.bundle,
//
// For example, if your Settings.bundle has the following entry:
//
// <dict>
// <key>Type</key>
// <string>PSMultiValueSpecifier</string>
// <key>Title</key>
// <string>Frequency</string>
@xinmyname
xinmyname / gist:61af21f5761b6ab919b6
Created August 25, 2014 17:30
Render Nancy View to text
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using Nancy;
using Nancy.Hosting.Self;
using Nancy.Testing;
using Nancy.ViewEngines;
namespace NancyTesting
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
Account* account = [_accounts objectAtIndex:[indexPath row]];
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:"AccountViewCell"];
[[cell textLabel] setText:account.name];
[[cell detailTextLabel] setText:account.email];
return cell;
}