Skip to content

Instantly share code, notes, and snippets.

@mootrichard
mootrichard / BEmsy.markdown
Created July 25, 2014 16:41
A Pen by Richard Moot.
// Phase 1
var decryptA = function(message){
var temp = message.split(" "),
i = 0,
result = [];
for(i = 0;i < temp.length;i++){
result.push(temp[i].slice(temp[i].length - 1))
}
result = result.join("");
return result;
/* eslint camelcase: 0 */
import Shippo from "shippo";
import { Meteor } from "meteor/meteor";
import { SimpleSchema } from "meteor/aldeed:simple-schema";
import { Logger } from "/server/api";
import { purchaseAddressSchema, parcelSchema } from "../lib/shippoApiSchema";
export const ShippoApi = {
methods: {}
};
@mootrichard
mootrichard / example_invalid_response.json
Last active April 14, 2017 17:19
An example of posting to Shippo's webhook using Node.JS
{
"carrier": "ups",
"tracking_number": "92748931507953573000007541",
"address_from": null,
"address_to": null,
"eta": null,
"servicelevel": {
"token": null,
"name": null
},
@mootrichard
mootrichard / example.js
Created April 24, 2017 18:30
Example International Rates Quote
const shippo = require('shippo')('YOUR_SHIPPO_TOKEN');
var customsItem = {
"description":"T-Shirt",
"quantity":20,
"net_weight":"1",
"mass_unit":"lb",
"value_amount":"200",
"value_currency":"USD",
"origin_country":"US",
@mootrichard
mootrichard / Rest API Planning.postman_collection.json
Created May 1, 2017 06:14
Rest API Planning Test Collection
{
"variables": [],
"info": {
"name": "Rest API Planning",
"_postman_id": "4b9b4065-d319-6f32-bae2-2dd4e0f33d0d",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
@mootrichard
mootrichard / addressValidation.js
Created June 20, 2017 17:22
4 Ways to Improve Post-Purchase Experience
const shippo = require('shippo')('YOUR_SHIPPO_API_KEY');
let addressObject = {
name: "Shawn Ippotle",
company: "Shippo",
street1: "218 Claytona St.",
city: "San Francisco",
state: "CA",
zip: "94117",
country: "US",
<script type="text/javascript" src="https://js.squareup.com/v2/paymentform">
</script>
cardNonceResponseReceived: function(errors, nonce, cardData) {
if (errors) {
// Log errors from nonce generation to the Javascript console
console.log("Encountered errors:");
errors.forEach(function(error) {
console.log(" " + error.message);
});
return;
}
console.log(cardData);