Skip to content

Instantly share code, notes, and snippets.


Lucas Garron lgarron

Block or report user

Report or block lgarron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lgarron / copyToClipboard.html
Last active Aug 30, 2019
Simple `navigator.clipboard.writeText()` polyfill.
View copyToClipboard.html
// A minimal polyfill for `navigator.clipboard.writeText()` that works most of the time in most modern browsers.
// Note that:
// - In Edge, this may call `resolve()` even if copying failed.
// - In Safari, this may fail if there is nothing selected on the page.
// See for a more robust solution.
// License: public domain
function writeText(str) {
return new Promise(function(resolve, reject) {
var success = false;
lgarron / console.log.cpp
Last active May 31, 2019
Trolling C++ using console.log
View console.log.cpp
/* Vararg code by Daniel Cheng (@zetafunction) */
#include <iostream>
#include <utility>
struct {
template<typename T>
static void log(T&& t) {
std::cout << t << "\n";
lgarron /
Created Feb 4, 2019
Example Solves

JS Cubing

if [ ! -d "alg" ]; then
   git clone       alg
if [ ! -d "kpuzzle" ]; then
   git clone   kpuzzle
if [ ! -d "twisty" ]; then
   git clone    twisty
lgarron /
Last active Jun 14, 2018
Algorithm Representation

In the example below, a "group" is a sequence of moves surrounded in parentheses.

Design goal

A representation of algorithms in JSON that also maps to native data structures and classes in most programming languages.

Desirable properties:

  1. Easy to represent in a programming language with lists and "classes" (objects with pre-defined patterns of properties).
  2. The data structures are straightforward to flatten to/from JSON.
lgarron / crbug-bookmarklet.js
Last active Jul 6, 2017
Copy a pretty URL version of a Chromium issue (e.g.
View crbug-bookmarklet.js
Convert to a bookmarklet using:
When you're on a Chromium issue page, this bookmarklet copies the short URL to clipboard. Also offers a markup version, a snippets version, and the pure ID.
Example: instead of
var clipboard = {};
clipboard.copy = (function() {
#!/usr/bin/env bash
# Setup script for a checkout of the Chromium HSTS preload list.
# Source -> and
echo "---- Creating folder and initializing a git repository. ----"
mkdir chromium-hsts && cd chromium-hsts
git init
echo "---- Adding chromium remote and initializing sparse checkout of /net/http. ----"
git remote add origin
View ѕрооғ
View Braille ASCII loading animation
Inspired by
lgarron /
Last active Apr 5, 2017
Replace using `ag` and `sed` in fish
# brew install gsed
for file in (ag -i -l "PageInfoPopupView" .)
echo $file
gsed --in-place="" "s/PageInfoPopupView/PageInfoBubbleView/g" $file
You can’t perform that action at this time.