This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----- SuperWatcher JQuery extension ----- | |
var watcher = new SuperWatcher(); | |
// Dynamically modify a CSS property when function result changes | |
$.fn.dynamicCss = function (prop, func) { | |
// Currying the $.css method | |
watcher.add(func.bind(this), this.css.bind(this, prop), prop); | |
// For function chaining | |
return this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env | |
# Convert Evernote notes in HTML to Markdown | |
# requires reverse_markdown (https://github.com/xijo/reverse_markdown) | |
# Preserve timestamp from Evernote | |
function get_timestamp { | |
reverse_markdown "$1" | \ | |
sed -n '/<meta name="created" content="/p' | \ | |
sed -e 's/<meta name="created" content="//g' | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Adapted from Lian Li’s (@chimney42) example: | |
https://slidr.io/Chimney42/machine-learning-with-synaptic | |
https://www.youtube.com/watch?v=M5glN6XjDv8 | |
You need to include synaptic.js - visit https://caza.la/synaptic/ | |
See my own tests at https://codepen.io/tomsoderlund/pen/MvLZLW | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Example: kill all non-development apps: | |
# . killapps.sh dev | |
# Example: kill all non-office apps in a soft way: | |
# . killapps.sh office soft | |
# Strip leading and trailing white space (new line inclusive). | |
trim () { | |
[[ "$1" =~ ^[[:space:]]*(.*[^[:space:]])[[:space:]]*$ ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "indianred", | |
"hexValue": "#cd5c5c", | |
"rgbValues": [205, 92, 92], | |
"hslValues": [0, 0.531, 0.582] | |
}, | |
{ | |
"name": "lightcoral", | |
"hexValue": "#f08080", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* parallelPool module | |
* @description A resource pool e.g. for projects. Inspired by https://www.npmjs.com/package/generic-pool | |
* @module parallelPool | |
* @author Tom Söderlund | |
*/ | |
// Private functions | |
/* const projectPool = new ParallelPool({}) */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext } from 'react' | |
import { UserContext, UserContextProvider } from './UserContext' | |
export default (props) => { | |
const [user, setUser] = useContext(UserContext) | |
return ( | |
<UserContextProvider user={null}> | |
<div>User name: {user && user.name}</div> | |
</UserContextProvider> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import ReactMapGL, { Marker, WebMercatorViewport } from 'react-map-gl' | |
const applyToArray = (func, array) => func.apply(Math, array) | |
const getBoundsForPoints = (points) => { | |
// Calculate corner values of bounds | |
const pointsLong = points.map(point => point.coordinates._long) | |
const pointsLat = points.map(point => point.coordinates._lat) | |
const cornersLongLat = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Usage: | |
import { ItemContextProvider } from 'hooks/useItem' | |
<ItemContextProvider | |
item={item} | |
> | |
<ComponentThatUsesItem /> |
OlderNewer