Skip to content

Instantly share code, notes, and snippets.

View xinmyname's full-sized avatar

Andy Sherwood xinmyname

View GitHub Profile
@xinmyname
xinmyname / serveandwatch.ps1
Created April 28, 2014 15:32
Start an HTTP server and watch the folder for changes
Start-Process python.exe -argument '-m http.server'; Start-Process livereloadx.cmd
@xinmyname
xinmyname / gist:83cbf6d5dd9901d434f3
Last active August 29, 2015 14:02
What could be simpler?
MERGE INTO vegetation.PlotHeader AS Target
USING (VALUES(@PlotNumber,@SurveyDate,GETDATE(),@ProjectId,@PlantCommId,@Comments,@PlotId,@NorthShadePercentage,@EastShadePercentage,@SouthShadePercentage,@WestShadePercentage))
AS Source(PlotNumber,SurveyDate,LastModified,ProjectId,PlantCommId,Comments,PlotId,NorthShadePercentage,EastShadePercentage,SouthShadePercentage,WestShadePercentage)
ON
(
Target.SurveyDate = Source.SurveyDate AND
Target.ProjectId = Source.ProjectId AND
Target.PlantCommId = Source.PlantCommId AND
Target.PlotNumber = Source.PlotNumber
)
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell?
{
let account = _accounts[indexPath!.row]
let cell = tableView!.dequeueReusableCellWithIdentifier("AccountViewCell") as UITableViewCell
cell.textLabel.text = account.name
cell.detailTextLabel.text = account.email
return cell
}
- (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;
}
@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
@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 / 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 / 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 / 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 / mysignature.cs
Created January 27, 2011 22:44
my signature
using System;public class
Sig{public static void Main()
{for(int i=65;;i=i>82?65:i+9)
Console.Write((char)i);}}