Skip to content

Instantly share code, notes, and snippets.

View DanElliottPalmer's full-sized avatar
😶‍🌫️

Dan Palmer DanElliottPalmer

😶‍🌫️
View GitHub Profile
@DanElliottPalmer
DanElliottPalmer / stupid_uids.js
Last active January 5, 2022 11:39
Generates a list of unique id that can only exist if the word version of the number successfully contains all the digits in the word.
const NUMBERS_TO_LETTERS = new Map([
["0", "o"],
["1", "i"],
["2", "z"],
["3", "e"],
["4", "h"],
["5", "s"],
["6", "b"],
["7", "l"],
["8", "b"],
function LazyEventListeners(){
this._listeners = {};
}
LazyEventListeners.prototype = {
constructor: LazyEventListeners,
has: function has(propertyKey){
return this._listeners.hasOwnProperty(propertyKey);
},
_createListener: function _createListener(propertyKey, eventTarget,
import random
_DEF = object()
def bogo_range(start, end=_DEF, step=1):
if end is _DEF:
end = start
start = 0
if not isinstance(start, int):
raise TypeError(
@DanElliottPalmer
DanElliottPalmer / somefile.txt
Last active September 9, 2016 16:21
some des
lol gordon lol
/**
* I need to set a fallback font for a web font. However that fallback font
* needs to be a web font
*/
@font-face {
font-family: "FallbackFont";
font-weight: bold;
src: url('some-place.woff');
}
@DanElliottPalmer
DanElliottPalmer / arnie_quotes.json
Last active August 29, 2015 14:25
Arnold Schwarzenegger quotes
[
"Oh, cookies! I can't wait to toss them.",
"I've seen a lot, but nothing would ever make me cut out my tongue.",
"If you yield only to a conqueror, then prepared to be conquered.",
"Why don't they just call him Girl George?",
"Can you hurry up. My horse is getting tired.",
"You've seen those movies where they say \"Make my day.\" or \"I'm your worst nightmare.\", well listen to this one. Rubber Baby Buggy Bumpers!",
"What killed the dinosaurs? The Ice Age!",
"If you drop your gun now, I promise I won't kill you.",
"That's for sleeping with my wife!",
@DanElliottPalmer
DanElliottPalmer / gist:6ed1b0534c8e15f1ea2e
Last active August 29, 2015 14:17
ValidatedMap - Example of what I wanted to do following this curiosity: https://gist.github.com/DanElliottPalmer/aa22a3c038d5f2ef94d2
class ValidatedMap {
clear(){
this._.clear();
}
constructor( _validationRules, _defaultValues ){
let validationRules = _validationRules || null;
let defaultValues = _defaultValues || [];
this._ = new Map();
@DanElliottPalmer
DanElliottPalmer / gist:aa22a3c038d5f2ef94d2
Last active August 29, 2015 14:17
ES6 Map inheritance
/**
* I can do this
*/
function AwesomeArray(){
Array.call( this );
}
AwesomeArray.prototype = Object.create(Array.prototype);
var awesomeness = new AwesomeArray();
awesomeness.push("example");
@DanElliottPalmer
DanElliottPalmer / index.html
Last active October 2, 2015 15:21
Image resize based on landscape proportions - http://jsbin.com/tigaw/2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h3>Landscape correct proportions</h3>
<div class="image__panel">
@DanElliottPalmer
DanElliottPalmer / ie-version.js
Created December 12, 2013 15:04
Detect IE in javascript Had issues with a CMS I use removing conditional statements in the page so figured this would be a way if I ever need to do it again. Taken from: http://abbett.org/post/a-guide-to-building-webapps-with-ie8-support
var ie = (function(){
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]