Skip to content

Instantly share code, notes, and snippets.

View Chiamaka's full-sized avatar

Chiamaka Nwolisa Chiamaka

View GitHub Profile
@Chiamaka
Chiamaka / react-native-debugger.md
Last active January 6, 2018 12:07
Configuring react-native-debugger (https://github.com/jhen0409/react-native-debugger) in your react-native project

Installing react native debugger

Step 1: brew update && brew cask install react-native-debugger

Step 2: cd into the project && npm i --save-dev react-native-debugger-open

Step 3: Add this to the scripts object in package.json

"scripts": { "postinstall": "rndebugger-open" }

@Chiamaka
Chiamaka / Firebase-rules
Created July 5, 2017 14:25
Firebase rules for restricting logged in users to their own bucket. Something like multi tenancy
// Firebase rules for restricting logged in users to their own bucket. SOmething like multi tenancy
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
const courseMap = {
C: ['A', 'B', 'F', 'H', 'D', 'G'],
B: ['K', 'L'],
H: ['E', 'J'],
D: ['A', 'B']
};
const learnCourse = (course) => {
const coursesChecked = {};
@Chiamaka
Chiamaka / 99BottlesLyrics.swift
Created December 1, 2017 00:52
Print out lyrics to the 99 bottles song using swift http://www.99-bottles-of-beer.net/lyrics.html
import UIKit
func bottlesLyrics(numberOfBottles: Int) {
for bottles in (1...numberOfBottles).reversed() {
let bottlesMinusOne = bottles - 1
let bottleTag = bottles == 1 ? "bottle" : "bottles"
var computedString = ""
if bottlesMinusOne == 0 {
computedString = "no more bottles"
//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])
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>
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, 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 {
// 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({