Skip to content

Instantly share code, notes, and snippets.

@andersosthus
andersosthus / _searchresults.html.erb
Created February 15, 2011 20:39
ActionView::Template::Error (undefined method `model_name' for PatchedOpenStruct:Class): 1: $("#searchresults").html("<%= escape_javascript(render(@searchresults)) %>");
<% @searchresults.each do |movie| %>
Found: <%= movie.name %> | <%= movie.id %><br />
<% end %>
@andersosthus
andersosthus / gist:2363499
Created April 11, 2012 23:40
Ruby Haversine
def haversine(lat1, long1, lat2, long2)
dtor = Math::PI/180
r = 6378.14*1000
rlat1 = lat1 * dtor
rlong1 = long1 * dtor
rlat2 = lat2 * dtor
rlong2 = long2 * dtor
dlon = rlong1 - rlong2
foreach (var level in data)
{
var root = DataTree.Nodes.Add(Guid.NewGuid().ToString(), level.Key);
RecAddNode(level, root);
}
@andersosthus
andersosthus / ApplicationManifest.xml
Created February 9, 2016 15:23
Describes how to secure your OWIN/ASP.NET 5 endpoints in ServiceFabric without having to log on to each VM and do stuff.
<ApplicationManifest>
...
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="SERVICENAME" ServiceManifestVersion="1.0.0" />
<Policies>
<EndpointBindingPolicy CertificateRef="MyCertificateName" EndpointRef="ServiceEndpoint" />
</Policies>
</ServiceManifestImport>
...
<Certificates>

Keybase proof

I hereby claim:

  • I am andersosthus on github.
  • I am andersosthus (https://keybase.io/andersosthus) on keybase.
  • I have a public key ASCKdz5D23fQJEjxF3Pmvs-4i7KJRDqptWol3tKmEWQZWQo

To claim this, I am signing this object: