Skip to content

Instantly share code, notes, and snippets.

View krestenlaust's full-sized avatar
🚩
Learning Antlr and Scala

Kresten Laust krestenlaust

🚩
Learning Antlr and Scala
View GitHub Profile
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
document.onkeydown = function(e){
switch(e.key) {
case "1":
document.querySelectorAll("button.answerA")[0].click();
break;
case "2":
document.querySelectorAll("button.answerB")[0].click();
break;
case "3":
document.querySelectorAll("button.answerC")[0].click();
@kosamari
kosamari / _ServiceWorker_for_github_pages.md
Last active April 1, 2024 05:44
ServiceWorker for github pages.

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@fuzzykiller
fuzzykiller / Greasemonkey.js
Last active February 16, 2020 11:20 — forked from azu/Greasemonkey.js
Greasemonkey API stubs with JSDoc, for WebStorm etc
/**
* Created by azu.
* Date: 10/11/28
* Updated by fuzzykiller (2015/08/28)
* License: MIT License
*/
/**
* An object that exposes various information about Greasemonkey and the running User Script.
*/
@jpoehls
jpoehls / gist:2030795
Created March 13, 2012 19:02
Using CTRL+W to close tabs in Visual Studio

In Tools | Options | Keyboard...

  1. Add CTRL+W as a Global shortcut for Window.CloseDocumentWindow
  2. Remove the CTRL+W shortcut for Edit.SelectCurrentWord

The caveat to this is if you are used to using CTRL+W to select the current word. If you do, find another shortcut that works for that.

@dciccale
dciccale / LICENSE.txt
Created July 31, 2011 09:30 — forked from 140bytes/LICENSE.txt
Detect if Flash Player is installed in your browser (120bytes)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Denis Ciccale <http://webdecs.wordpress.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active May 6, 2024 21:38
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:foo@example.com", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))