Skip to content

Instantly share code, notes, and snippets.

View omahlama's full-sized avatar

Olli Mahlamäki omahlama

View GitHub Profile
@omahlama
omahlama / List1.jsx
Last active November 26, 2020 08:44
Pattern for encapsulating logic in react hooks and components
import React from 'react';
import { DataTable } from './DataTable';
import { useSearch, SearchInput } from './useSearch1';
const List1 = ({ data }) => {
const { searchTerm, setSearchTerm, filteredData } = useSearch(data);
return <div>
<SearchInput value={searchTerm} onChange={setSearchTerm} />
<DataTable data={filteredData} />
@omahlama
omahlama / .bash_profile
Created April 6, 2018 07:32
I keep typoing git as got, now I get a nice quote every time
# Typo git to got
alias got='sort -R ~/got.txt | head -n1 && echo "
--Game of thrones
" && git'
@omahlama
omahlama / gist:ff5a879ca209b3b1d287
Created February 9, 2015 07:18
Mixin for react components that have a Bacon.model named "model" as a property
var BaconModelMixin = {
componentDidMount: function() {
this.unsubscribe = this.props.model.onValue(this.setState.bind(this));
},
componentWillUnmount: function() {
if(this.unsubscribe) {
this.unsubscribe();
}
}
}
@omahlama
omahlama / keybase.md
Created October 7, 2014 08:17
Keybase proof

Keybase proof

I hereby claim:

  • I am omahlama on github.
  • I am omahlama (https://keybase.io/omahlama) on keybase.
  • I have a public key whose fingerprint is 277F 7321 D104 9C8A 5732 DC69 7E0E 0281 43DE 9E72

To claim this, I am signing this object:

<!DOCTYPE html>
<html>
<head>
<title>Frontend/UX friendship without limits</title>
<meta charset="utf-8">
<style>
* {
@omahlama
omahlama / index.html
Created November 28, 2012 08:53 — forked from jareware/index.html
Frontend/UX friendship without limits scratchpad
<!DOCTYPE html>
<html>
<head>
<title>Frontend/UX friendship without limits scratchpad</title>
<meta charset="utf-8">
<!-- Include Twitter Bootstrap CSS -->
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap.min.css" rel="stylesheet">