Skip to content

Instantly share code, notes, and snippets.

- (void)setupMapSnapshot
{
CLLocationCoordinate2D coordinate = self.outlet.annotaion.coordinate;
MKMapSnapshotOptions* options = [MKMapSnapshotOptions new];
options.size = self.mapImageView.frame.size;
options.scale = [[UIScreen mainScreen] scale];
options.region = MKCoordinateRegionMakeWithDistance(coordinate, 2000.f, 2000.f);
MKMapSnapshotter* snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options];
@azcoov
azcoov / static_map_helper.rb
Created March 8, 2017 04:17 — forked from mcasimir/static_map_helper.rb
Google Maps Static map helper for Ruby on Rails
module StaticMapHelper
def static_map_for(location, options = {})
params = {
:center => [location.lat, location.lng].join(","),
:zoom => 15,
:size => "300x300",
:markers => [location.lat, location.lng].join(","),
:sensor => true
}.merge(options)
@azcoov
azcoov / DatabaseCall.cs
Created January 30, 2017 17:50 — forked from benhysell/DatabaseCall.cs
c# Redis Caching Objects with StackExchange.Redis using Json
//extension method make a database call by providing a function pointer to Task<T> and passing in a method parameter
public static async Task<T> DatabaseCall<T>(this IDatabase cache, string key, Func<string, Task<T>> databaseCall, string methodParameter, TimeSpan timeSpan, bool invalidate, bool useCache)
{
T returnValue;
var cachedItem = default(T);
try
{
cachedItem = await cache.GetAsync<T>(key);
}
catch (RedisConnectionException ex)
using Bugsnag.Clients;
using System;
using System.Web.Mvc;
namespace MyAwesomeWebApp
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public sealed class BugsnagExceptionHandler : HandleErrorAttribute
{
internal BugsnagExceptionHandler()
var QUEUE_URL = 'https://sqs.us-east-1.amazonaws.com/{AWS_ACCUOUNT_}/matsuoy-lambda';
var AWS = require('aws-sdk');
var sqs = new AWS.SQS({region : 'us-east-1'});
exports.handler = function(event, context) {
var params = {
MessageBody: JSON.stringify(event),
QueueUrl: QUEUE_URL
};
sqs.sendMessage(params, function(err,data){
@azcoov
azcoov / nn_reviews_widget_tech.html
Created April 8, 2014 19:07
Nearby Now Javascript Widget - Tech Page Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>John's Recent Reviews</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
@azcoov
azcoov / 1-nn-gallery-js.js
Created January 28, 2014 21:38
Example of the Nearby Now Photo Gallery Widget Script
@azcoov
azcoov / nn-photo-gallery.html
Last active August 22, 2017 03:14
Example implementation of the Nearby Now Photo Gallery widget. Just add your API to the data-key tag and you're good to go.
@azcoov
azcoov / 1_review_mini.html
Last active May 18, 2017 21:06
Simple HTML examples of embedding the Nearby Now Javascript Widget
<!-- Add this script on the page that you want to embed the reviews widget -->
<script
src="https://s3.amazonaws.com/reviewcloud/widget/v2/reviews.min.js"
data-key="your_api_token">
</script>
<!-- Add this div where you'd like the widget to display on your page -->
<div id="nn-reviews"></div>
@azcoov
azcoov / 1_nn_reviews_widget.js
Last active May 18, 2017 21:05
Example of the Nearby Now Reviews Widget Script
<script src="https://s3.amazonaws.com/reviewcloud/widget/v2/reviews.min.js"
data-key="your_api_token">
</script>