Skip to content

Instantly share code, notes, and snippets.

View hanse's full-sized avatar
💯

Hans-Kristian Koren hanse

💯
View GitHub Profile
@hanse
hanse / routes.js
Created October 3, 2017 19:08
Example of nested react-navigation navigators
import React, { Component } from 'react';
import { Platform, View } from 'react-native';
import { StackNavigator, TabNavigator, TabBarBottom } from 'react-navigation';
import Icon from 'react-native-vector-icons/Ionicons';
// Credits to @richardfickling
// https://github.com/react-community/react-navigation/issues/686
function DismissableStackNavigator(routes, options) {
const Navigator = StackNavigator(routes, options);
return class extends Component {
const fs = require('fs');
const recast = require('recast');
const humps = require('humps');
const code = fs.readFileSync('./app/actions/ActionTypes.js');
const b = recast.types.builders;
const actions = [];
const ast = recast.parse(code);

Keybase proof

I hereby claim:

  • I am Hanse on github.
  • I am hanse (https://keybase.io/hanse) on keybase.
  • I have a public key whose fingerprint is CC05 CAE4 9D95 0A5D 943B 8D80 C458 3A02 57EB D7A5

To claim this, I am signing this object:

@hanse
hanse / Makefile
Created March 5, 2014 12:45
pandoc makefile
MD=$(shell find . -name "*.md")
PDF=$(MD:.md=.pdf)
all: $(PDF)
%.pdf: %.md
pandoc -s -N $< -o $@
clean:
rm -f $(PDF)
@hanse
hanse / shortestpath.py
Created December 6, 2013 14:05
Shortest path algorithms
from heapq import heappop, heappush
from copy import deepcopy
Inf = float('inf')
def printmatrix(M):
"""
Print a nicely formatted matrix.
"""
for i in range(len(M)):
@hanse
hanse / AppDelegate.h
Created August 8, 2012 08:20
tomarild @ mac1.no
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>
@property (strong, nonatomic) UITabBarController *tabBarController;
@property (strong, nonatomic) UIWindow *window;
@end
<?php
post('/posts', function($params) {
// implementation code for post creation
});
put('/posts/(?P<id>\d+)', function($params) {
// write code to update a post
});