This file contains hidden or 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 cote = require('cote'); | |
| const responder = new cote.Responder({ name: 'arbitration API', key: 'arbitration' }); |
This file contains hidden or 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 cote = require('cote'); | |
| const responder = new cote.Responder({ name: 'currency conversion responder' }); | |
| const rates = { usd_eur: 0.91, eur_usd: 1.10 }; | |
| responder.on('convert', (req, cb) => { | |
| cb(req.amount * rates[`${req.from}_${req.to}`]); | |
| }); |
This file contains hidden or 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 rates = { usd_eur: 0.91, eur_usd: 1.10 }; | |
| responder.on('convert', (req, cb) => { // ideally, you would sanitize your input here. | |
| cb(req.amount * rates[`${req.from}_${req.to}`]); | |
| }); |
This file contains hidden or 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 cote = require('cote'); | |
| const requester = new cote.Requester({ name: 'currency conversion requester' }); | |
| const request = { type: 'convert', from: 'usd', to: 'eur', amount: 100 }; | |
| requester.send(request, (res) => { | |
| console.log(res); | |
| }); |
This file contains hidden or 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 request = { type: 'convert', from: 'usd', to: 'eur', amount: 100 }; | |
| requester.send(request, (res) => { | |
| console.log(res); | |
| }); |
This file contains hidden or 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 requester = new cote.Requester({ name: 'currency conversion requester' }); |
This file contains hidden or 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 cote = require('cote'); |
This file contains hidden or 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
| # xcode-build-bump.sh | |
| # @desc Auto-increment the build number every time the project is run. | |
| # @usage | |
| # 1. Select: your Target in Xcode | |
| # 2. Select: Build Phases Tab | |
| # 3. Select: Add Build Phase -> Add Run Script | |
| # 4. Paste code below in to new "Run Script" section | |
| # 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
| # 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |
This file contains hidden or 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
| public class FizzBuzz { | |
| public static void main(String[] args) { | |
| for (int i = 1; i < 100; i++) { | |
| String output = ""; | |
| if (i % 3 == 0) output += "Fizz"; | |
| if (i % 5 == 0) output += "Buzz"; | |
| System.out.println(output.isEmpty() ? i : output); | |
| } | |
| } |
This file contains hidden or 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 | |
| # Installs tarsnap client on Debian and Ubuntu | |
| # | |
| # You'll need to setup an account at | |
| # http://www.tarsnap.com | |
| # and load it with some funds | |
| # | |
| # Make sure you run this as root | |
| # |