Skip to content

Instantly share code, notes, and snippets.

View thierryc's full-sized avatar

Thierry Charbonnel thierryc

View GitHub Profile
@thierryc
thierryc / Axis.js
Created December 30, 2017 00:10 — forked from MrToph/Axis.js
Charts in React Native with React-Native-SVG and D3.js
import React, { Component, PropTypes } from 'react'
import { G, Line, Path, Rect, Text } from 'react-native-svg'
import * as d3scale from 'd3-scale'
import { dateToShortString } from '../utils'
export default class Axis extends Component {
static propTypes = {
width: PropTypes.number.isRequired,
ticks: PropTypes.number.isRequired,
x: PropTypes.number,
@thierryc
thierryc / one-at-a-time.js
Last active May 29, 2021 22:03
Javascript Jenkins's one-at-a-time hash function
// An implementation of Jenkins's one-at-a-time hash
// <http://en.wikipedia.org/wiki/Jenkins_hash_function>
// key: string
// return hex
function oneAtATimeHash(key) {
var hash = 0, i = key.length;
while (i--) {
hash += key.charCodeAt(i);
hash += (hash << 10);
hash ^= (hash >> 6);