Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Code.Eat.Watch

Joseph Mutuku Kyalo thoth-ky

👨‍💻
Code.Eat.Watch
View GitHub Profile
@thoth-ky
thoth-ky / App.js
Created Apr 29, 2020
React Table Component
View App.js
import React, {useState } from 'react';
import './App.css';
const initialStuff =[[1,"a","b"], [2,"c","d"], [3,"e","f"]]
function App() {
const [stuff, setStuff] = useState(initialStuff)
const updateStuff = () => {
@thoth-ky
thoth-ky / JosephKyalo.md
Last active Apr 20, 2020
Joseph Kyalo Resume
View JosephKyalo.md

JOSEPH MUTUKU KYALO

Software Developer (2 Years)

I am a passionate technophile and full-stack software engineer. I have a background in Electrical & Telecommunication Engineering. Over the last 2 years, I have been working professionally as a Software Engineer in remote teams building world-class products. I do not shy away from a challenge and I am always willing to seek help from my team. Beyond web development, I am always looking for ways I can use emerging technologies such as AI to make the product better. Outside work, I love music and when not listening to music I am either reading a book or enjoying a friendly game of chess.

CONTACTS

@thoth-ky
thoth-ky / config.py
Last active Feb 21, 2020
This GIST shows how to use configparser to interpolate env variables within
View config.py
import configparser
import os
class CustomEnvInterpolation(configparser.BasicInterpolation):
"""Interpolation which expands environment variables in values."""
def before_get(self, parser, section, option, value, defaults):
super().before_get(parser, section, option, value, defaults)
if not os.environ.get('MY_ENV'):
@thoth-ky
thoth-ky / App.jsx
Last active Mar 18, 2019
Setting UP the React on Rails with Apollo
View App.jsx
//app/javascript/packs/front-end-react/App.jsx
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { ApolloProvider } from "react-apollo"
import { client } from "./apollo"
import Book from './src/bookComponent';
class App extends Component {
render() {
View index.html.erb
# app/views/index/index.html.erb
<%= javascript_pack_tag 'front-end-react/App' %>
<%= stylesheet_pack_tag 'front-end-react/assets/stylesheets/App' %>
View application.html.erb
# app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>RailsReactGraphql</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
</head>
View book_type.rb
# app/graphql/types/book_type.rb
module Types
class BookType < Types::BaseObject
graphql_name 'BookType'
field :id, ID, null: false
field :title, String, null: false
field :author, String, null: true
field :review, String, null: true
View query_type.rb
app/graphql/types/query_type.rb
module Types
class QueryType < Types::BaseObject
field :all_books, [BookType], null: true, description: "Returns a list of all Books"
field :book, BookType, null: true do
description "Returns book given an ID"
argument :id, ID, required: true
end
View seeds.rb
# db/seeds.rb
Book.create(
title: "A brief History of Time",
author: "Stephen Hawking",
review: "A very informative book from an insiders perspective in the language of an outsider",
reviewer: "John Doe"
)
Book.create(
title: "Unbowed",
You can’t perform that action at this time.