Skip to content

Instantly share code, notes, and snippets.

View powerc9000's full-sized avatar
🧺

Clay Murray powerc9000

🧺
View GitHub Profile
import React, {Component} from "react";
import {getTranslation} from "./translator";
class Translate extends Component {
render(){
const key = children;
const translation = getTranslation(key, this.props.default);
<div>
<Translation default="Welcome">homepage_welcome</Translation>
</div>
@powerc9000
powerc9000 / hoc.js
Last active January 16, 2019 18:44
HOC and injection
const HOC = (Wrapped) => {
return class Dialog extends Component {
state = {
open: false,
text: ""
}
toggle = () => {
this.setState({
open: !this.state.open
})
@powerc9000
powerc9000 / post.md
Last active March 23, 2024 05:48
Making Your Own 2.5D Renderer Thing In C++ For Fun

So I like to program. And I guess I like the idea of making a game. I really haven't finised many. Previously most of my attempts have been in Javacript using canvas I made some library/engine thing even. I mean it isn't very good is it?

Anyway, I think writing low level code makes you cool. And I want to be cool like Casey Muratori or Jonathan Blow I also think old school engines like Build, Doom, or Wolfenstien 3D are cool. Which makes me want to eschew all better ideas and do one similar to those. However, since I don't hate myself completely. I do use SDL for the platform layer.

In the rest of this post I will go over some cool things I think I do.

@powerc9000
powerc9000 / translations.md
Last active November 27, 2018 15:57
Translations with Firebase

At my place of work we were doing translations with json files and key value pairs.

eg. en-US.json

{
  "this_key": "Translates to this"
}
@powerc9000
powerc9000 / post_a_day.md
Last active February 7, 2017 05:54
Post a Day

I would like to get better at writing. Expecially technical writing.

Therefore I am making it my goal to create a blog post a day for a month.

Since this is supposed to be a programming blog I will attempt to keep that focus.

Hopefully I can think of something to post everyday.

Onto something programming related.

@powerc9000
powerc9000 / automating_lambda_deployment.md
Last active January 8, 2020 12:49
Automating Lambda Deployment With Travis-CI

I really hate doing things myself when I can have a computer do it for me.

So In this post I will describe how I automate lambda deployment with travis-ci.

Create a AWS role that has these permissions.

{
    "Version": "2012-10-17",
 "Statement": [
@powerc9000
powerc9000 / lambda_cloudfront.md
Last active January 12, 2017 00:16
Running lambdas as your server with cloudfront.

So recently in my work I have wanted to pre-render some of our pages and then keep the cached version in cloudwatch.

There are a few options in doing this.

You can set up an EC2 instance. Or use ECS.

However, what if you don't want to pay to have and EC2 instance running all the time. You have a budget!

Enter lambdas. AWS lambdas can be created to run based on events. Sadly you can't directly integrate with lambda from cloudwatch (except for lambda@edge but that is a different use case). This isn't too hard AWS even has a nice article on it for us. http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html

@powerc9000
powerc9000 / creating_ios_archives.md
Created July 19, 2016 06:10
Creating and uploading iOS archives from the command line.

I don't like IDEs. I want to code in my editor and use the command line for everything else. I like the flow better and it feels faster to me.

I also like to have one command to do several things I want to do.

I don't want to open Xcode to create an archive, then open the archive window, then upload the archive to iTunes. It's slow and breaks my flow.

Also, in react native, it's trivial to build Android releases on the command line. I want to create and upload both iOS and android from the command line.

So after hours of searching the internet I found a flow I like for creating and uploading archives for iOS all from the command line

@powerc9000
powerc9000 / post.md
Last active August 19, 2018 15:38
Globals In React Native

Recently I ran into a problem in React Native.

I wanted to be able to have more granular control of my build besides React Native's __DEV__.

Our QA people need to have a few tools at their disposal to run the APP vs our live and test servers. I don't want to make them download the project on Github and run it. That would force them onto a mac for iOS builds. I don't want to ship the app with __DEV__ on. It would be quite complex to have them connect to some dev package server to run the app A third option was needed. There should be a __QA__ flag. This way I can release the APP in without __DEV__ but keep some QA features I want. The naive way would be to have something like a globals.js file that you include and edit the file for different releases. eg.