Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

David Aurelio davidaurelio

💭
I may be slow to respond.
  • Adobe
  • Munich, Germany
View GitHub Profile
@davidaurelio
davidaurelio / dabblet.css
Created Mar 27, 2020
Slider with filled track – gradients
View dabblet.css
/**
* Slider with filled track – gradients
*/
.slider {
height: 32px;
position: relative;
--fill-start: 0.5;
--gap: 4px;
--progress: 0.5;
@davidaurelio
davidaurelio / dabblet.css
Created Mar 26, 2020
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
background-image: linear-gradient(90deg, yellow 25%, transparent 25%, transparent 30%, yellow 30%),
linear-gradient(90deg, transparent 15%, gray 15%, gray 25%, transparent 25%, transparent 30%, gray 15%, gray 25%, transparent 30%);
min-height: 100%;
@davidaurelio
davidaurelio / dabblet.css
Last active Mar 25, 2020
Slider with filled track
View dabblet.css
/**
* Slider with filled track
*/
.slider {
height: 32px;
position: relative;
--fill-start: 0.5;
--gap: 4px;
--progress: 0.5;
View fearNotLetter.js
function fearNotLetter(str) {
let last = str.charCodeAt(0);
for (let i = 1; i < str.length; ++i) {
const code = str.charCodeAt(i);
if (code !== last + 1) return String.fromCharCode(last + 1);
last = code;
}
}
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>count bits</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@davidaurelio
davidaurelio / create.js
Created Feb 22, 2011
Constructor-less inheritance for ECMAScript 5
View create.js
var BaseObject = {
create: function create() {
var instance = Object.create(this);
instance._construct.apply(instance, arguments);
return instance;
},
extend: function extend(properties, propertyDescriptors) {
propertyDescriptors = propertyDescriptors || {};
View output-beautified.js
!function() {
function n() {
for (var n = arguments.length, e = Array(n), r = 0; r < n; r++) e[r] = arguments[r];
return "(s*(" + e.join(")s*,s*(") + ")s*)";
}
new RegExp("rgb" + n()), new RegExp("rgba" + n()), new RegExp("hsl" + n()), new RegExp("hsla" + n());
}();
View repro.js
var u = require('uglify-es');
var code = `
(function() {
var NUMBER = '[-+]?\\d*\\.?\\d+';
var PERCENTAGE = NUMBER + '%';
function call() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
@davidaurelio
davidaurelio / EventEmitter.js
Created Mar 22, 2012
Constructable mixins in JavaScript
View EventEmitter.js
/*
EventEmitter is usable as constructor and as mixin.
*/
function EventEmitter() {}
// this does the trick
EventEmitter.prototype = EventEmitter;
EventEmitter.addListener = function(type, listener) {
this.listeners(type, true).push(listener);
@davidaurelio
davidaurelio / .profile
Last active Dec 20, 2015
bash helper function to make debugging node cli programs easier.
View .profile
node-debug () {
PROGRAM="$(which $1)" # make sure we get an absolute path for programs in PATH
shift # remove the original program argument
set -- "$PROGRAM" "$@" # prepend the program path
node --debug-brk $@ & # start node in paused debug mode, send to background
node-inspector # start node inspector
kill %% # kill the background task (if still running)
}
You can’t perform that action at this time.