This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <string> | |
#include <sstream> | |
#include "esphome/components/display/display_buffer.h" | |
#include "text_wrap.h" | |
using namespace esphome; | |
using namespace esphome::display; | |
void wrap_text(DisplayBuffer* it, int x, int y, const char* text, Font* font, TextAlign align, float line_height) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var scriptName = "embed.js"; //name of this script, used to get reference to own tag | |
var jQuery; //noconflict reference to jquery | |
var jqueryPath = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"; | |
var jqueryVersion = "1.8.3"; | |
var scriptTag; //reference to the html script tag | |
/******** Get reference to self (scriptTag) *********/ | |
var allScripts = document.getElementsByTagName('script'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"event": "subscriber.subscribed", | |
"data": { | |
"object": { | |
"id": 99999, | |
"email": "[email protected]", | |
"fields": { | |
"first_name": "John", | |
"last_name": "Doe" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Licence: MIT | |
# Created by tomykaira, 2011-10-25 | |
if [ $# -ne 1 ]; then | |
echo "Give me your new project name (only)" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_ducksboard | |
api_key = "" | |
api_secret = "" | |
url = "https://#{api_key}:#{api_secret}@api.preact.io/api/v2/insights/health" | |
data = RestClient.get "#{url}", :content_type => :json, :accept => :json | |
accounts = data["accounts"] | |
# boxes | |
push_duck("YOUR_DATAPOINT_ID", accounts["good"]) # good account health |
NewerOlder