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
sudo apt update && sudo apt install xz-utils firefox-esr -y
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get install -y nodejs
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 23E7166788B63E1E
sudo apt update -y && sudo apt install yarn -y
yarn global add firebase-tools
yarn global add @vue/cli
echo "# yarn" >> ~/.profile
@tyohan
tyohan / firestore-module.js
Last active May 13, 2021 16:42
How to load the Firebase Firestore with ES6 module without using the bundler tool. I use it to lazy load the Firebase Firebase in my vanilla web component. To use it you just need to import and construct an instance, then call load() and handle the promise resolve.
export default class FirestoreModule{
constructor(apiKey,authDomain,databaseURL,projectId){
this.promise=false;
this.db=null;
this.apiKey=apiKey;
this.authDomain=authDomain;
this.databaseURL=databaseURL;
this.projectId=projectId;
}
@ethaizone
ethaizone / server_time_sync.js
Last active June 12, 2024 02:12
Sync server time to client browser with JS. Implement follow Network Time Protocol.
// Thanks http://stackoverflow.com/questions/1638337/the-best-way-to-synchronize-client-side-javascript-clock-with-server-date
var serverTimeOffset = false;
function getServerTime(callback) {
if (serverTimeOffset === false) {
var scripts = document.getElementsByTagName("script"),
URL = scripts[scripts.length - 1].src;
var clientTimestamp = Date.parse(new Date().toUTCString());
@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>
@zdarovka
zdarovka / Usage.html
Last active April 18, 2018 05:58
Pageable-content element based on core-list
<st-pageable-content id="pageableContent"
urltemplate="/Episodes/Page-{page}" appurltemplate="/serials/{page}" currentpage="{{currentPage}}" dataname="episode"
data="{{data}}" width="400" height="170" grid on-core-activate="{{selectView}}">
<template>
<st-episode-tile data="{{model}}"></st-episode-tile>
</template>
</st-pageable-content>
@pachacamac
pachacamac / clap.html
Last active April 26, 2022 19:22
Clap Detection in JS
<html>
<head>
<title>AudioPlayground</title>
<style>* {box-sizing: border-box;}</style>
</head>
<body>
<h3>AudioPlayground</h3>
<p>If you're happy and you know it, clap your hands!</p>
<script>
var Recording = function(cb){
@olivernn
olivernn / Readme.md
Created June 8, 2013 13:49
Getting started with lunr

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))
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 28, 2024 21:36
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname