Skip to content

Instantly share code, notes, and snippets.

// 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 / 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.

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.

#!/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
@fiznool
fiznool / date-duration.js
Created February 5, 2015 10:27
Date Duration
Date.prototype.duration = function(granularity) {
if(!granularity) {
granularity = 's';
}
var units = [{
enabled: /^[wdhms]$/.test(granularity),
singular: 'week',
plural: 'weeks',
inMillis: 7 * 24 * 60 * 60 * 1000
@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',
@fiznool
fiznool / index.js
Created December 18, 2014 08:19
request basic auth
var request = require('request');
// The `auth` object will take precedence
// over the `Authorization` header
var options = {
url: 'http://requestb.in/1jt9nmk1',
method: 'GET',
headers: {
Authorization: 'Basic 1234'
},