Skip to content

Instantly share code, notes, and snippets.

View Chiamaka's full-sized avatar

Chiamaka Nwolisa Chiamaka

View GitHub Profile
@Chiamaka
Chiamaka / tilde-symbol-conversion
Last active February 21, 2023 16:44
Convert to ` symbol on EU keyboards
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064},{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}'
@Chiamaka
Chiamaka / cloudSettings
Last active February 3, 2021 12:43
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-01-19T11:44:16.374Z","extensionVersion":"v3.4.3"}
@Chiamaka
Chiamaka / countingSort.js
Created August 26, 2018 14:35
Counting Sort Implementation In Javascript
/*
Some background:
- Most sorting algorithms like mergesort, quick sort, selection sort, run in O(n log n) time
- Counting sort says it can do better with O(n) time but with a caveat of using more space (O(n) space)
- Counting sort requires 2 ingredients:
1. The unsorted array
2. The higest possible value in the array. So like the range
*/
const unsortedScores = [2, 5, 10, 1, 3, 7, 9];
const HIGHEST_POSSIBLE_SCORE = 10;
import React, { PureComponent } from 'react';
import { View, Text, Animated, TouchableWithoutFeedback } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import PropTypes from 'prop-types';
export default class MinusButton extends PureComponent {
render() {
const translateMinusCircle = this.props.animationValue.interpolate({
inputRange: [0, 1],
outputRange: [60, 0]
import React, { PureComponent } from 'react';
import { View, Text, Animated, TouchableWithoutFeedback } from 'react-native';
import AddButton from './AddButton';
import MinusButton from './MinusButton';
import Counter from './Counter';
export default class CompleteComponent extends PureComponent {
state = {
animationValue: new Animated.Value(0),
counterAnimation: new Animated.Value(0),
import React, { PureComponent } from 'react';
import { View, Text, Animated, TouchableWithoutFeedback } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import PropTypes from 'prop-types';
export default class AddButton extends PureComponent {
// NOTE: For the sake of reusability, I pass the animationValue as a prop to the AddButton, MinusButton
render() {
// this rotates the circle 90 degrees when the animated value reaches 1
const rotatePlusCircle = this.props.animationValue.interpolate({
import React, { PureComponent } from 'react';
import { View, Animated } from 'react-native';
import AddButton from './AddButton';
import MinusButton from './MinusButton';
import Counter from './Counter';
export default class CompleteComponent extends PureComponent {
state = {
counter: 1
};
import React, { PureComponent } from 'react';
import { View, Text, Animated, TouchableWithoutFeedback } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import PropTypes from 'prop-types';
export default class AddButton extends PureComponent {
render() {
return (
<TouchableWithoutFeedback>
<Animated.View style={styles.counterIncrementStyle}>
import React, { PureComponent } from 'react';
import { View, Text, NetInfo, Dimensions, StyleSheet } from 'react-native';
const { width } = Dimensions.get('window');
function MiniOfflineSign() {
return (
<View style={styles.offlineContainer}>
<Text style={styles.offlineText}>No Internet Connection</Text>
</View>
//This method of solving the fibonacci sequence assumes that since the first three values never change, just state it
// and start index 3
// Fibonacci sequence example: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
// Under *Dynamic Programming*: https://www.ics.uci.edu/~eppstein/161/960109.html
// 1st iteration
func fibonacci(until: Int) {
var f = [0, 1, 1]
for i in 3...until {
f.append(f[i-2] + f[i-1])