Skip to content

Instantly share code, notes, and snippets.

class HelloMailer < ApplicationMailer
def welcome(user)
headers 'X-MSYS-API': { "options": { "open_tracking": true, "click_tracking": true } }.to_json
mail(to: user.email, subject: 'Welcome!')
end
end
LocationService.getCoords()
.then(function (coords) {
console.log(coords);
});
angular.module('myapp.services', [])
.service('LocationService', function ($cordovaGeolocation, $q) {
return {
askLocationPermission: function () {
var permissions = cordova.plugins.permissions, // could not find a better way to access cordova; it's not in $window
deferred = $q.defer();
permissions.requestPermission(permissions.ACCESS_COARSE_LOCATION, function(result) {
deferred.resolve();
}, function(err) {
LocationService.askLocationPermission()
.then(LocationService.getCoords)
.then(function(coords) {
console.log(coords);
})
.catch(function(err) {
console.log(err);
});
angular.module('myapp.services', [])
.service('LocationService', function ($cordovaGeolocation) {
return {
askLocationPermission: function (successCallback, errorCallback) {
var permissions = cordova.plugins.permissions; // could not find a better way to access cordova; it's not in $window
permissions.requestPermission(permissions.ACCESS_COARSE_LOCATION, successCallback, errorCallback);
}
getCoords: function () {
// omitted for brevity
<?php
namespace Examples\Transmissions;
require dirname(__FILE__).'/../bootstrap.php';
use SparkPost\SparkPost;
use GuzzleHttp\Client;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
import { Notifications } from 'expo';
import { AppState, Platform } from 'react-native';
import { Component } from 'react';
const isIos = Platform.OS === 'ios';
export class NotificationHandler extends Component {
state = {
appState: AppState.current
};