Skip to content

Instantly share code, notes, and snippets.

@Leftium
Leftium / summarize.coffee
Last active March 20, 2024 16:05
Toggle Bookmarklet
url = new URL location
{host, searchParams} = url
params =
summary: searchParams.get 'summary'
url: searchParams.get 'url'
# Not summary
if host isnt 'kagi.com'
# Go to summary
@Leftium
Leftium / versioned-doc.coffee
Created August 25, 2022 00:23
Versioned JSON document
class VersionedDoc
constructor: (json) ->
if json
if json._id then @_id = json._id
@versions = json._versions
if @versions.constructor isnt Array
@versions = [ new Date() ]
@props = {}
for propName of json
if propName[0] isnt '_'
@Leftium
Leftium / ignore_node_modules.sh
Created February 22, 2022 01:37
Recursively ignore node_modules in Dropbox. Git for Windows edition.
#!/bin/sh
# vim: wrap!
# Recursively ignore node_modules in Dropbox. Git for Windows edition.
# Based on: https://stackoverflow.com/a/69655523/117030
find "$1" -type d | grep 'node_modules$' | grep -v '/node_modules/' | xargs -I {} -t powershell -command "Set-Content -Path '{}' -Stream com.dropbox.ignored -Value 1"
@Leftium
Leftium / convertri-toastr.js
Created February 17, 2017 03:23
Add notification to Convertri when form is successfully submitted
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script>
// http://stackoverflow.com/a/2880929/117030
var urlParams;
(window.onpopstate = function () {
@Leftium
Leftium / example-modded-inlined.html
Created July 28, 2016 11:21
The reveal.js markdown example modified to support inlining into a single html file.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Markdown Demo</title>
<style>/*!
* reveal.js
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">
<head>
<style type="text/css">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
</script>
@Leftium
Leftium / dojo-fy.js
Created August 15, 2012 12:40
Add Dojo to any website with a single click of this bookmarklet.
// based on http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
//
(function() {
var el=document.createElement('div'),
b=document.getElementsByTagName('body')[0],
msg='';
el.style.position='fixed';
el.style.height='20px';
el.style.width='100%';
el.style.marginLeft='0px';