Skip to content

Instantly share code, notes, and snippets.

View matt-leonardo's full-sized avatar

matt-leonardo

View GitHub Profile
@matt-leonardo
matt-leonardo / hash_of.js
Created January 18, 2018 15:03
Convert URL to Hash
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery
export const hashOf = (str) => {
/*jshint bitwise:false */
let i;
let l;
let hval = 0x811c9dc5;
// let hval = (seed === undefined) ? 0x811c9dc5 : seed;
const asString = true;
@matt-leonardo
matt-leonardo / smart_image.js
Created January 18, 2018 14:58
Caching Image in Expo
import React from 'react';
import { Image } from 'react-native';
import { FileSystem } from 'expo';
import { hashOf } from '../../utils/';
class SmartImage extends React.PureComponent {
state = { source: this.props.source };
componentDidMount() {