Skip to content

Instantly share code, notes, and snippets.

@joeflateau
joeflateau / deferredObservable.js
Created December 16, 2013 16:17
Super easy jQuery+KnockoutJS deferred observable w/ajax
function deferredObservable(initialValue, creator){
if (!creator){
creator = initialValue;
initialValue = null;
}
if ($.type(creator) === "string") {
var getUrl = creator;
creator = function(){ return $.get(getUrl); };
}

ES6 Defaults / Overrides Pattern

Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.

function foo ({ bar = 'no', baz = 'works!' }) {
  return(`${bar}, ${baz}`);
}

console.log(foo({

Keybase proof

I hereby claim:

  • I am joeflateau on github.
  • I am joeflateau (https://keybase.io/joeflateau) on keybase.
  • I have a public key ASBl-_Z9OvQMOBqCEOooqfoyySXVOshxq4FaQODqrgWacQo

To claim this, I am signing this object:

function umountsmbfs(){
for D in `mount -t smbfs | sed 's/.* on \(.*\) [(].*/\1/'`; do umount $D; done; mount;
}
function sawtailf(){
group=$1
hours=$2
if [ -z "$hours" ]; then
hours=1
fi
declare module 'video.js' {
namespace videojs {
interface Player {
ima(options: any): this;
}
}
}
import videojs = require('video.js');
declare module 'video.js' {
namespace videojs {
interface Player {
ima(options: any): this;
}
}
}
declare module 'video.js' {
namespace videojs {
interface Player {
ima(options: any): this;
}
}
export default videojs;
}
import videojs, { VideoJsPlayer } from 'video.js';
const Plugin = videojs.getPlugin('plugin');
// default setting
const defaultSetting: VideoJsMarkerPluginSettings = {
markerStyle: {
width: '7px',
'border-radius': '30%',
'background-color': 'red'
@joeflateau
joeflateau / pip-bookmarklet.url
Created December 21, 2021 00:44
Html5 Video Picture in picture bookmarklet
javascript:with(document.querySelector("video")){
removeAttribute('disablePictureInPicture');
requestPictureInPicture();
}