Skip to content

Instantly share code, notes, and snippets.

View marcus7777's full-sized avatar
:octocat:
Working from bike

Marcus Hitchins marcus7777

:octocat:
Working from bike
View GitHub Profile
@marcus7777
marcus7777 / listAllEventListeners.js
Created September 20, 2018 06:41 — forked from dmnsgn/listAllEventListeners.js
List all event listeners in a document
const listeners = (function listAllEventListeners() {
let elements = [];
const allElements = document.querySelectorAll('*');
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];
@marcus7777
marcus7777 / web_crypto_api_example.js
Last active July 25, 2017 11:08
Web Crypto API example
// for uint8array = new TextEncoder("utf-8").encode("¢");
// for string = new TextDecoder("utf-8").decode(uint8array);
var string = new Uint8Array([0x01, 0x02])
var data = new Uint8Array([0x03, 0x04, 0x05])
var handle_error = function (error) {
cnosole.log("Error:",error)
}
@marcus7777
marcus7777 / top-500-sites.json
Last active November 2, 2016 07:03 — forked from woisme/top-500-sites.json
Top 500 sites in json
<!doctype html>
<meta charset='utf-8'>
<html>
<head>
<title>card-info-server-test demo</title>
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="card-info-server-test.html">
</head>
<body>
<h3>card-info-server-test Demo</h3>
@marcus7777
marcus7777 / index.html
Last active March 22, 2016 11:34 — forked from akki777-zz/index.html
Trial on paper-swatch-picker
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/iron-icons/maps-icons.html">
<link rel="import" href="/bower_components/neon-animation/animations/scale-up-animation.html">
<link rel="import" href="/bower_components/neon-animation/animations/fade-out-animation.html">
<link rel="import" href="/bower_components/paper-swatch-picker/paper-swatch-picker.html">
<dom-module id="add-label">
<template>
<paper-dialog entry-animation="scale-up-animation" exit-animation="fade-out-animation" with-backdrop>
<center>
<h2>Create a new Label</h2>
@marcus7777
marcus7777 / tmux-cheatsheet.markdown
Created January 20, 2016 15:39 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@marcus7777
marcus7777 / progressive-ace.htm
Created September 28, 2015 17:56 — forked from duncansmart/progressive-ace.htm
Integrating ACE Editor in a progressive way
<textarea name="my-xml-editor" data-editor="xml" rows="15"></textarea>
...
<textarea name="my-markdown-editor" data-editor="markdown" rows="15"></textarea>
...
<script src="//d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<script>
// Hook up ACE editor to all textareas with data-editor attribute
$(function () {
@marcus7777
marcus7777 / index.html
Last active September 1, 2015 10:35 — forked from anonymous/index.html
pair-production demo// source http://jsbin.com/xuzute
<!doctype html>
<html>
<head><base href="http://open-elements.org/bower_components/new/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<title>pair-production demo</title>
<html>
<head>
<meta charset="utf-8">
<base href="http://golowan.org/stuff/bower_components/">
<script href="webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="firebase-element/firebase-document.html">
<link rel="import" href="firebase-element/firebase-collection.html">
</head>
@marcus7777
marcus7777 / Readme.md
Last active August 29, 2015 14:25 — forked from olivernn/Readme.md

Getting Started with Lunr

There are two ways to use lunr to index some documents, The simplest way is to just build the index client side each time the page is loaded. search.js shows an example of this.

If your data is relatively static it might be more efficient to generate the index server side and then load this on each page load, your can see an example of generating the index in node in builder.js.

You can load a serialised index like this:

var idx = lunr.Index.load(JSON.parse(json_string))
#!/bin/sh
cd /home/dstrt/www
unset GIT_DIR
git pull origin master