Skip to content

Instantly share code, notes, and snippets.

View kristerkari's full-sized avatar

Krister Kari kristerkari

  • Helsinki, Finland
View GitHub Profile
@kristerkari
kristerkari / Geolocation.ts
Created July 11, 2019 08:50
Wrap Web or React Native Geolocation API with Observables
import RNGeolocation from "@react-native-community/geolocation";
import { Observable } from "rxjs";
export interface Coordinates {
/**
* a double representing the position's latitude in decimal degrees.
*/
latitude: number;
/**
declare const Icons: {
"500px": string;
addressBook: string;
addressBookO: string;
addressCard: string;
addressCardO: string;
adjust: string;
adn: string;
alignCenter: string;
alignJustify: string;
function sortByKey(obj) {
var newObj = {};
Object.keys(obj).sort().forEach(function(key) {
newObj[key] = obj[key];
});
return newObj;
}
var obj = {
b: 2,
@kristerkari
kristerkari / gist:6178137
Created August 7, 2013 20:13
Grunt globbing perf
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
From: https://github.com/addyosmani/polymer-grunt-example/blob/master/Gruntfile.js
@kristerkari
kristerkari / __git_ps1.fish
Last active December 25, 2017 11:35
Fish config/prompt
# Port of the Bash version bundled with git
# Bodaniel Jeanes
function __git_ps1
set -l g (git rev-parse --git-dir ^/dev/null)
if [ -n "$g" ]
set -l r ""
set -l b ""
if [ -d "$g/rebase" ]
if [ -f "$g/rebase/rebasing" ]
@kristerkari
kristerkari / lazyeval-strict.html
Last active November 23, 2016 09:45
Lazyeval strict mode
<html>
<body>
<!-- ----------------------------------------------- -->
<!-- inline script block with commented code inside: -->
<!-- ----------------------------------------------- -->
<script id="myjscode">
/*
'use strict';(function(h,v){function q(b){if(""===m)return b;
@kristerkari
kristerkari / lazyeval.html
Last active February 6, 2020 04:00
Lazy evaluating Javascript code
<html>
<body>
<!-- ----------------------------------------------- -->
<!-- inline script block with commented code inside: -->
<!-- ----------------------------------------------- -->
<script id="myjscode">
/*
(function(h,v){function q(b){if(""===m)return b;