Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Build fast things or build things fast

David Alexander Bjerremose DaBs

🚀
Build fast things or build things fast
View GitHub Profile
View throttle.h
#ifndef THROTTLE_H
#define THROTTLE_H
#include <stdint.h>
#include <stdbool.h>
uintptr_t THROTTLE_CallbackEnqueue(uint32_t timeout, void (*timerCallback)());
uint32_t THROTTLE_ReadTime();
View spaceship-prompt-options
# Spaceship configuration
SPACESHIP_PROMPT_ORDER=(
user # Username section
host # Hostname section
dir # Current directory section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
package # Package version
node # Node.js section
ruby # Ruby section
View useCallbackTimingSequence.ts
import { MutableRefObject, useCallback, useRef } from 'react';
export type Callback<T extends any[]> = (...args: T) => void;
export interface ICallbackTimingOptions<T extends any[]> {
singleCallback?: Callback<T>;
}
export function useCallbackTimingSequence<T extends any[]>(
callback: Callback<T>,
View css-extract-assets.js
/* eslint-disable */
const path = require('path');
const fs = require('fs-extra');
const md5File = require('md5-file');
class Postprocessor {
constructor(options) {
View calendar-functions.js
const MILISECONDS_IN_A_DAY = 1000 * 60 * 60 * 24;
const getDaysInMonth = (month, year = (new Date()).getFullYear()) => {
return new Date(year, month + 1, 0).getDate();
}
const getMonday = (d) => {
const parsedDate = new Date(d);
const day = parsedDate.getDay();
const difference = parsedDate.getDate() - day + (day == 0 ? -6 : 1);
View es6-feature-detection.js
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
View fix-for-viewheight.js
var elems = document.querySelectorAll('.element-selector');
window.addEventListener('resize', function(e) {
elems.forEach(function(elem){
elem.clientHeight = window.innerHeight;
});
});