Skip to content

Instantly share code, notes, and snippets.

View TrejGun's full-sized avatar
🌴
On vacation

Trej Gun TrejGun

🌴
On vacation
View GitHub Profile
@RedHatter
RedHatter / DateMultiPicker.jsx
Last active August 4, 2021 02:14
Range and multi select for @dmtrKovalenko/material-ui-pickers
import React, { useState, useContext, useRef } from 'react'
import { DatePicker } from 'material-ui-pickers'
import { MuiPickersContext } from 'material-ui-pickers'
export default function DateMultiPicker({
value,
onChange,
labelFunc,
format,
emptyLabel,
@tiarno
tiarno / iframe_vis.js
Last active January 29, 2020 08:41
javascript: is element inside an iframe visible within the viewport?
// Given an iframe id and an anchor id that is present within the iframe,
// determine whether the element is visible/present inside the window viewport.
// This is not about the css 'display' property; this shows whether
// the window viewport contains the element.
var isVisible = function (anchor, iframe_id) {
var ifrId = iframe_id || 'bv_page';
var ifrOffset = window.parent.document.getElementById(ifrId).offsetTop;
var myloc = document.getElementById(anchor).offsetTop + ifrOffset;
var viewtop = window.parent.scrollY;
@m4r00p
m4r00p / looped-deferred.js
Last active December 21, 2015 08:29
Looped deferred
var getDeferred = function (i) {
var deferred = new $.Deferred();
setTimeout(function () {
if (--i) {
deferred.resolve(i);
} else {
deferred.reject(i);
}
}, 2000);
@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position