Skip to content

Instantly share code, notes, and snippets.

View Tiny-Giant's full-sized avatar

Tiny Giant Tiny-Giant

  • Ladysmith, BC, Canada
View GitHub Profile
@Tiny-Giant
Tiny-Giant / jsbin.pahakiq.css
Created September 24, 2019 21:09
JS BinModal with event-driven paradigm// source https://jsbin.com/pahakiq
html, body {
margin: 0;
height: 100%;
}
modal-wrapper {
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
@Tiny-Giant
Tiny-Giant / jsbin.dunaliv.css
Last active September 24, 2019 21:11
JS BinModal without event-driven paradigm// source https://jsbin.com/dunaliv
html, body {
margin: 0;
height: 100%;
}
modal-wrapper {
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
@Tiny-Giant
Tiny-Giant / This answer is a stub. A partial solution for partial answers on Meta.md
Created August 5, 2019 18:24
This answer is a stub. A partial solution for partial answers on Meta

I'm fairly certain most of us have seen this text at some point on Wikipedia:

This article is a stub. You can help Wikipedia by expanding it.

- https://en.wikipedia.org/wiki/Template:Stub

With the primary goal of a frictionless option for partial answers to encourage:

  • those with partial answers to post their partial answers using the answer form instead of the comment form, and
  • the community to jump in and help flesh out such partial answers instead of downvoting them because they aren't fleshed out

How to create a programming problem

Programming problems must be both well defined and reasonably scoped.

  • Well defined programming problems are clear and unambiguous. They must not be open to interpretation and all important variables(?) must be defined and accounted for.

    // Examples of poorly defined and well defined programming problems

  • Reasonably scoped programming problems are distilled to a specific problem, without being overly specific. Trying to cover too much ground and including too many details both reduce the usefulness of the question and the likeliness of receiving an answer, and can lead to question closure.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
const XHR = XMLHttpRequest;
unsafeWindow.XMLHttpRequest = new Proxy(XHR, {
construct: (target, args) => {
const listeners = [{
regex: /close\/add/,
get: data => {
if(data.property === 'responseText') {
console.log(xhr.responseText);
const obj = JSON.parse(xhr.responseText);

#BAD!

$('.link').on('click', _ => $('.link').attr('href', $('.link').attr('href').replace(/#.+/,'')));

#GOOD!

const link = $('.link');

link.on('click', _ => link.attr('href', link.attr('href').replace(/#.+/, ''));

@Tiny-Giant
Tiny-Giant / Tic-Tac-Toe.js
Last active March 12, 2018 00:04
A prompt/confirm tic-tac-toe game using ES6
(() => {
"use strict";
const game = () => {
let done;
const solutions = [
[ 0, 1, 2 ], [ 0, 3, 6 ], [ 0, 4, 8 ],
[ 1, 4, 7 ], [ 2, 4, 6 ], [ 2, 5, 8 ],
[ 3, 4, 5 ], [ 6, 7, 8 ]
];