Skip to content

Instantly share code, notes, and snippets.

View Chiamaka's full-sized avatar

Chiamaka Nwolisa Chiamaka

View GitHub Profile
@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"
const courseMap = {
C: ['A', 'B', 'F', 'H', 'D', 'G'],
B: ['K', 'L'],
H: ['E', 'J'],
D: ['A', 'B']
};
const learnCourse = (course) => {
const coursesChecked = {};
<!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">
@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"
}
}
@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 / createStore.js
Created June 30, 2017 16:18
Notes on how createStore works internally
const counter = (state=0, action) => {
switch(action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from "react";
import { Text, View, StatusBar, Platform, Button } from "react-native";
const MyStatusBar = ({ backgroundColor, ...props }) =>
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { Router, Scene, Actions } from 'react-native-router-flux';
import Icon from 'react-native-vector-icons/Ionicons';
import Shows from './OnAir';
import Stations from './Stations';
const TabIcon = props => {
console.log('selected', props.selected); //undefined
return (
" don't bother with vi compatibility
set nocompatible
" enable syntax highlighting
syntax enable
" configure Vundle
filetype on " without this vim emits a zero exit status, later, because of :ft off
filetype off
set rtp+=~/.vim/bundle/vundle/
[...document.querySelectorAll('.invite-card')].forEach((card) => {
const acceptBtn = card.querySelector('.bt-invite-accept');
acceptBtn.click();
});