1 minute read

Mon. 27 June

You can run Cisco AnyConnect command from the terminal

printf 'USERNAME\nPASSWORD\ny' | /opt/cisco/anyconnect/bin/vpn -s connect HOST

It’s the same as you type your user id and password but you can script it so that you don’t have to type in the same details

26 June

In typescript, interface and type are almost the same, except interface has merge capability. I’m not sure if I would ever use interface merge, though.

https://stackoverflow.com/questions/37233735/interfaces-vs-types-in-typescript

interface Point {
    x: number;
    y: number;
}

// could be written as the type alias

type Point = {
    x: number;
    y: number;
};

24 June

A GraphQL Playground Config file. It’s a JSON file that you can store all your endpoints.

{
  "schemaPath": "schema.graphql",
  "extensions": {
    "endpoints": {
      "orders_uat": {
        "url": "https://orders.uat.api.com/graphql"
      }
    }
  }
}

22 June

A handy UK postcode npm package

import { parse } from 'postcode'

const parsedPostcode = parse(postcode)
if (!parsedPostcode.valid) {
  setValidation({...validation, postcode: 'The postcode is invalid'})
}
setPostcode(parsedPostcode.postcode || '')

21 June

This is a handy tool to test the network connectivity of your mobile application. To use it, download AdditionalTools from apple developer website.

Once it’s downloaded, open the .dmg file and install Network Link Condition.prefPane by double-clicking it in Hardware folder. It’ll be installed in the system preference, so you can search it there from next time.

Querying DynamoDB data with javascript SDK v3

DynamoDBDocumentClient has different syntax. Use KeyConditionExpression instead of KeyConditions

import { Context } from 'aws-lambda'
import { QueryCommand } from '@aws-sdk/lib-dynamodb'

import { ddbDocClient } from '../services/dynamodbClient'

export const handler = async (ev: any, context: Context) => {
  console.log(ev)
  const params = {
    TableName: `table-${process.env.run_env}`,
    KeyConditionExpression: 'userId = :userId',
    ExpressionAttributeValues: {
      ':userId': ev.arguments.userId
    }
  }

  try {
    const data = await ddbDocClient.send(new QueryCommand(params))
    return data.Items
  } catch (error) {
    throw error
  }
}

You can run the code locally with yarn command.

"run-list-registrations-by-userid": 
  "yarn build && node -e \"require('./dist/list-by-userid').handler(require('./list-by-userid-event.json')).then(x => console.log(x));\"",

PBXResourcesBuildPhase unknown UUID

I did pod install and had an error saying “PBXResourcesBuildPhase attempted to initialize an object with an unknown UUID”

There seem to be a merge issue when I installed a couple of react-native pod packages. A stackoverflow answer helped me out.

pod deintegrate app.xcodeproj
pod install

Tags:

Updated:

Comments