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
import 'package:piota_api/src/config.dart' as appconfig; | |
import 'dart:io'; | |
import 'package:test/test.dart'; | |
void main() { | |
test('configfromJson', () async { | |
final file = File('/Users/paulryan/Documents/projects.nosync/flutter/piota/api/test/fixtures/app_config2.json'); | |
final str = await file.readAsString(); | |
final json = appconfig.configFromJson(str); | |
//print(str); |
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
{ | |
// Place your snippets for dart here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", |
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
class Monad { | |
constructor(val) { | |
this.__value = val; | |
} | |
static of(val) {//Monad.of is simpler than "new Monad(val)" | |
return new Monad(val); | |
}; | |
map(f) {//Applies the function but returns another Monad! | |
return Monad.of(f(this.__value)); | |
}; |
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
const fizzBuzz = x => { | |
let test1 = x % 3 === 0 ? 1 : 0; | |
let test2 = x % 5 === 0 ? 2 : 0; | |
return test1 | test2; | |
}; | |
const printFizzBuzz = (item, val) => { | |
let x = val + 1; | |
switch (fizzBuzz(x)) { | |
case 1: | |
console.log("Fizz"); |
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 regex = /(ERROR ITMS-90189: "Redundant Binary Upload. There already exists a binary upload with build ')([0-9.]{5})(.)([0-9.]{10})(.*)/g; | |
var str = `ERROR ITMS-90189: "Redundant Binary Upload. There already exists a binary upload with build '1.8.0.1501059235' for version '1.8.0'"`; | |
var m, version, buildNo; | |
while ((m = regex.exec(str)) !== null) { | |
// This is necessary to avoid infinite loops with zero-width matches | |
if (m.index === regex.lastIndex) { | |
regex.lastIndex++; | |
} |
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
'use latest' | |
module.exports = function (context, cb) { | |
var request = require("request"); | |
//37.8267 | |
//-122.4233 | |
var url = `https://api.darksky.net/forecast/${context.data.dsApiKey}/${context.data.latitude},${context.data.longitude}?exclude=%5Bminutely,daily,%20%20flags%5D?units=%5Buk2%5D`; | |
var options = { | |
method: 'GET', | |
url: url | |
}; |
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
/* | |
* set a webtask called checkrKey for your API key | |
*/ | |
module.exports = function (ctx, request, response) { | |
var request = require("request"); | |
var authKey = 'Basic ' + ctx.secrets.checkrKey; | |
var url = 'https://api.checkr.com/v1/reports/' + ctx.data.id; | |
var options = { | |
method: 'POST', | |
url: url, |
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
return function (context, cb) { | |
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: context.secrets.ACCESS_KEY, | |
secretAccessKey: context.secrets.SECRET_KEY, | |
region: 'eu-west-1' | |
}); | |
var sns = new AWS.SNS(); |
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
/* | |
* use of ramda fantasy Maybe for deep inspection of an object property | |
* see https://github.com/ramda/ramda-fantasy/blob/master/docs/Maybe.md | |
* for more info | |
*/ | |
const R = require("ramda"); | |
const M = require("ramda-fantasy").Maybe; | |
const Just = M.Just; | |
const Nothing = M.Nothing; | |
const response = { |
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
require 'xcodeproj' | |
project_path = "./platforms/ios/helloWorld.xcodeproj" | |
project = Xcodeproj::Project.open(project_path) | |
#add the bundle as a reference | |
bundle_path = "../../includes/OTABundle.bundle" | |
bundleRef = project.new_file(bundle_path); |
NewerOlder