Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ "$GIT_SSH_KEY" != "" ]; then
echo "Cleaning up SSH config" >&1
echo "" >&1
# Now that npm has finished running,
# we shouldn't need the ssh key/config anymore.
# Remove the files that we created.
rm -f ~/.ssh/config
rm -f ~/.ssh/deploy_key
// Inspired by https://stackoverflow.com/a/50523132/1171775
import React, { Component } from 'react';
import {
Animated,
StatusBar,
StyleSheet,
Text,
View,
} from 'react-native';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
@fiznool
fiznool / hashid.js
Created November 16, 2014 09:45
Short 'hash' ID generator.
'use strict';
/**
* The default alphabet is 25 numbers and lowercase letters.
* Any numbers that look like letters and vice versa are removed:
* 1 l, 0 o.
* Also the following letters are not present, to prevent any
* expletives: cfhistu
*/
var ALPHABET =
@fiznool
fiznool / fix-rn-xcode10.sh
Created October 30, 2018 11:59
Fixes the third party dependency issues introduced by Xcode 10's new build system.
#!/usr/bin/env bash
# Fix the third party mess. Run this after a `npm/yarn` install.
# This has (hopefully) been addressed by https://github.com/facebook/react-native/pull/21458,
# but at the time of writing (30/10/18) has not been merged into an official RN release.
echo "Fixing React Native third party folder..."
rm -rf ~/.rncache
WD=$(pwd)
cd node_modules/react-native
rm -fr third-party
@fiznool
fiznool / fix-rn-0.57.sh
Last active October 30, 2018 11:56
Fix React Native v0.57 third party dependencies
#!/usr/bin/env bash
# Fix the third party mess. Run this after a `npm/yarn` install.
# This has (hopefully) been addressed by https://github.com/facebook/react-native/pull/21458,
# but at the time of writing (17/10/18) has not been merged into an official RN release.
echo "Fixing React Native third party folder..."
rm -rf ~/.rncache
WD=$(pwd)
cd node_modules/react-native
rm -fr third-party
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/9.4.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'publish' ]
2 info using npm@5.6.0
3 info using node@v9.4.0
4 verbose npm-session 968a30f9973db62d
5 verbose publish [ '.' ]
6 info lifecycle react-native-in-app-browser@0.1.0~prepublish: react-native-in-app-browser@0.1.0
7 info lifecycle react-native-in-app-browser@0.1.0~prepare: react-native-in-app-browser@0.1.0
@fiznool
fiznool / react-native-setup.md
Last active December 5, 2017 21:47
Guide to setting up the React Native development environment.
@fiznool
fiznool / index.js
Last active October 5, 2017 16:19
Testing some date parsers
// Testing out some date parsing libraries.
'use strict';
var chrono = require('chrono-node');
require('datejs');
require('sugar');
var stringsToParse = [
'today',

As discussed on gitter, the plan is to implement the error handling as a two-stage process.

  1. Add an additionalCodes property to the error object passed in as the third argument to the api handler. This will specify the additional error responses that should be setup by API Gateway, and the associated regexes.
  2. Create a new claudia-api-errors module, which will allow developers to throw a predefined set of Error objects, which will correspond to response codes.

Only 1. needs to be implemented to allow multiple error responses, 2. is more of a nice-to-have.

Background

API Gateway allows you to parse the error message returned from a lambda function, and apply a response code according to a regex that you configure. Here's a good primer on how this works.

@fiznool
fiznool / promises.js
Created July 31, 2013 08:41
Wrapper for jQuery promises to make them behave a little more like rsvp.js. Depends on jQuery and Underscore.
exports.promise = function(work) {
var dfd = $.Deferred();
work(dfd.resolve, dfd.reject);
return dfd.promise();
};
exports.promiseResolved = function() {
return $.Deferred().resolve().promise();
};