Skip to content

Instantly share code, notes, and snippets.

@devtanc
devtanc / App.js
Last active September 2, 2022 09:07
How to have `onXYZ` event hooks in a ReactNative Native UI Component in Swift
// This file is from an actual react app that would install the library outlined in the rest of these files
import React from 'react'
import { SafeAreaView, StyleSheet, View } from 'react-native'
import RichTextEditor from 'react-native-rich-text-editor'
const styles = StyleSheet.create({
body: {
flex: 1,
},
inputContainer: {
@devtanc
devtanc / withQuery
Created July 17, 2019 21:34
Apollo Client Query Wrapper Test
import { graphql } from 'react-apollo';
import { get } from 'lodash';
export default ({ query, options = () => {}, props = {}, skip = false }) =>
graphql(query, {
options: parentProps => ({
fetchPolicy: 'cache-and-network',
...options(parentProps),
}),
props,
@devtanc
devtanc / digit_sum.rs
Last active June 14, 2018 21:22
Sums digits of a given i32
fn main() {
let args: Vec<String> = std::env::args().collect();
let input = match args[1].parse::<i32>() {
Ok(num) => num,
Err(error) => panic!("The number provided is too large for an i32: {:?}", error)
};
println!("The sum of all digits is {}", sum_digits(&input));
}
fn sum_digits(num: &i32) -> i32 {
const taskData = {}
formatAppointment({ task: [], assignment: undefined })
function formatAppointment({ task, assignment }) {
const [ taskData ] = task;
// Error shows here due to the assignment property being a non-iterable value
const [ assignmentData ] = assignment;
return {
@devtanc
devtanc / kms.js
Created October 25, 2017 19:36
Node Credstash Decryption
const AWS = require('aws-sdk');
const https = require('https');
const crypto = require('crypto');
//Set up https agent for AWS
const agent = new https.Agent({
rejectUnauthorized: true,
keepAlive: true,
ciphers: 'ALL',
secureProtocol: 'TLSv1_method',
@devtanc
devtanc / load.sh
Last active October 25, 2017 04:08
Credstash Loader Loader
#!/bin/bash
# Loads credstah credentials from a file
# Pre-req:
# Need to have credstash installed and setup from: https://github.com/fugue/credstash
# Tables for credentials need to be named `credentials-<stage>`
#
# Stage defaults to 'development'
#
# File Format Spec
@devtanc
devtanc / googleCal.gs
Last active February 17, 2016 22:45
Calendars and Events in Google Calendars
function myFunction() {
Logger.log('Getting your default calendar');
var cal = CalendarApp.getDefaultCalendar();
Logger.log(cal.getId());
Logger.log(cal.getName());
Logger.log('________________________________________')
Logger.log('Getting all calendars');
var cals = CalendarApp.getAllCalendars();
cals.forEach(function(cal) {