Skip to content

Instantly share code, notes, and snippets.

@srkirkland
srkirkland / inlineedit.cshtml
Created March 31, 2014 21:48
ckeditor stuff
@model dynamic
@{
ViewBag.Title = "Inline Edit";
}
<script src="http://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.3.2/ckeditor.js"></script>
<h2>Inline Edit</h2>
@srkirkland
srkirkland / crazyasync.cs
Created May 15, 2014 18:12
crazy async stuff
var combinedTask = Task.WhenAll(instructorSummaries
.Select(instructorSummary =>
_instructorTable
.ExecuteAsync(TableOperation.InsertOrReplace(instructorSummary))))
.ConfigureAwait(false);
var evaluationTask = _evaluationTable.ExecuteAsync(TableOperation.InsertOrReplace(overallSummary)).ConfigureAwait(false);
var result = new EvaluationTableResult
{
@srkirkland
srkirkland / dynamicsplit.cs
Created May 27, 2014 22:43
split large binary array into multiple fields
var props = base.WriteEntity(operationContext);
props.Remove(SplitProperty);
for (int i = 0; i <= Summary.Length / SplitSize; i++)
{
props.Add(SplitProperty + i, new EntityProperty(Summary.Skip(i).Take(SplitSize).ToArray()));
}
return props;
@srkirkland
srkirkland / shortaddress.js
Created July 10, 2014 06:45
geocode just short address
var geocode = result.data;
if (geocode.results.length > 0) {
var address = geocode.results[0].address_components;
if (address.length > 1 & address[0].types.indexOf('street_number') !== -1 && address[1].types.indexOf('route') !== -1 ){ //want street and route
$scope.spec.address = address[0].long_name + ' ' + address[1].long_name;
} else {
$scope.spec.address = geocode.results[0].formatted_address;
}
}
@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: [
@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 / 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 / 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 / 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 / mapcontroller.cs
Created November 15, 2014 22:34
instantiate controller from main storyboard
AppDelegate.MapController = UIStoryboard.FromName ("MainStoryboard", null).InstantiateViewController ("MapController") as MapController;