Skip to content

Instantly share code, notes, and snippets.

@srkirkland
srkirkland / xamarinslowcamera.cs
Created February 6, 2015 07:25
animate camera
var newPosition = newMarker.Spec.GeoPoint;
var camera = mapView.Camera;
mapView.CameraPositionIdle += MapAnimateForSwipeComplete;
CATransaction.Begin ();
CATransaction.AnimationDuration = 2.0;
mapView.Animate (CameraUpdate.SetTarget (newPosition.ToCLLocationCoordinate2D (), camera.Zoom - 1));
CATransaction.Commit ();
@srkirkland
srkirkland / panmove.cs
Created February 5, 2015 06:41
finger tracking pan gesture recognizer.
//addtl info at https://github.com/johncadengo/JCWindowShade/blob/master/JCWindowShade/JCViewController.m#L137
var dragging = false;
contentView.AddGestureRecognizer (new UIPanGestureRecognizer ((pan) => {
if (dragging){
var origin = pan.LocationInView(View);
Console.WriteLine ("dragging at {0}", origin);
var translated = pan.TranslationInView(contentView);
var cf = contentView.Frame;
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace pagingnav
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
@srkirkland
srkirkland / georesults.json
Last active August 29, 2015 14:09
sample results
{
"version": 3,
"status": "ok",
"response": {
"data": [
{
"address": "1131 Folsom St",
"category_ids": [
358,
348,
@srkirkland
srkirkland / mapcontroller.cs
Created November 15, 2014 22:34
instantiate controller from main storyboard
AppDelegate.MapController = UIStoryboard.FromName ("MainStoryboard", null).InstantiateViewController ("MapController") as MapController;
@srkirkland
srkirkland / donormatching.sql
Last active August 29, 2015 14:07
some plsql for matching donor info
select * from OPENQUERY(AIS_STAGE, '
select * from
(select UTL_MATCH.JARO_WINKLER_SIMILARITY(last_name || '','' || first_name, ''kirkland,scott'') NameDiff,last_name, first_name from entity
order by NameDiff desc)
where rownum < 10
')
select * from OPENQUERY(AIS_STAGE, '
select email.email_address, telephone.telephone_number from entity
join email on email.id_number = entity.id_number
@srkirkland
srkirkland / popit.cs
Created August 6, 2014 23:46
ugly way to reset to the root view & change tabs
NavigationController.PopToRootViewController(false);
tabController.SelectedIndex = 1;
@srkirkland
srkirkland / urlrewrite.xml
Created August 5, 2014 22:56
url rewrite
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="site.ucdavis.edu" ignoreCase="true" />
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://site.ucdavis.edu/{R:1}" />
</rule>
@srkirkland
srkirkland / cellstyle.cs
Created July 20, 2014 23:02
cell with custom style
[Export("initWithStyle:reuseIdentifier:")]
public MyCustomCell(UITableViewCellStyle style, NSString cellIdentifier)
: base(SomeConstantValue, UITableViewCellStyle.Value1, cellIdentifier)
{
}
@srkirkland
srkirkland / givingsearch.json
Created July 16, 2014 22:26
json result from elasticsearch
{
_shards: {
Total: 1,
Successful: 1,
Failed: 0
},
hits: {
total: 1,
max_score: 1,
hits: [