Skip to content

Instantly share code, notes, and snippets.

View kimobrian's full-sized avatar
Soccer, Music, Code, Friends, Dinners, Cooking

Kimo kimobrian

Soccer, Music, Code, Friends, Dinners, Cooking
  • Nairobi,Kenya
  • 18:07 (UTC +03:00)
View GitHub Profile
@kimobrian
kimobrian / sqlalchemy_example.py
Created September 28, 2016 04:17 — forked from podhmo/sqlalchemy_example.py
sqlalchemy query example.
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker())
class BaseMixin(object):
query = DBSession.query_property()
id = sa.Column(sa.Integer, primary_key=True)
@kimobrian
kimobrian / .babelrc
Created March 28, 2017 07:15 — forked from dengjonathan/.babelrc
Webpack/ Babel/ Express Env for React
{
"plugins": ["react-hot-loader/babel"],
"ignore":[]
}
@kimobrian
kimobrian / NERDTree.mkd
Created October 26, 2017 13:27 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@kimobrian
kimobrian / karma.config.js
Created November 10, 2017 00:38 — forked from newcloudtech/karma.config.js
Webpack and karma configs
var webpackConfig = require('../webpack.config.js');
module.exports = function () {
autoWatch: true,
frameworks: ['jasmine'],
preprocessors: {
'../app/**/*.js': ['webpack'],
'../app/**/scripts/**/*.js': ['coverage']
},
webpack: {
resolve: webpackConfig.resolve,
@kimobrian
kimobrian / ngrxintro.md
Created November 12, 2017 12:53 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@kimobrian
kimobrian / introrx.md
Created November 25, 2017 12:11 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@kimobrian
kimobrian / 1_kubernetes_on_macOS.md
Created December 22, 2017 01:42 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

A Beginner's Guide to Ngrx/store

As someone who is fairly new to the world of Redux and to a certain extent Angular (not AngularJS), the thought of having to implement Redux to our app was very daunting. Not because it wasn't the right thing to do, our initial app was built quite quickly without much knowledge of Angular and in doing so it wasn't very testable, so Redux would help with that situation, the main difficulty was the learning curve.

Reducers; actions, states, the store, this vernacular was familiar to someone who had experience with Redux but not me, and the whole process is quite verbose, I mean–why would you split your code which was originally in one file, the component into multiple, the reducer, action and state? There are however, a lot of companies who use and find a lot of benefits form it, so I decided to do a deep dive into how and why it works and documented my find

@kimobrian
kimobrian / client-server-post-request-ex-in-pure-node.md
Created January 28, 2018 21:19 — forked from umidjons/client-server-post-request-ex-in-pure-node.md
Client/Server post request example in pure Node.js

Client/Server POST request example in pure Node.js

File server.js:

var http = require('http');
var querystring = require('querystring');

var server = http.createServer().listen(3000);

server.on('request', function (req, res) {
@kimobrian
kimobrian / cmd.sh
Created January 29, 2018 16:10 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/