Skip to content

Instantly share code, notes, and snippets.

@islishude
islishude / caret.js
Last active November 26, 2023 00:16
[DEPRECATED]get/set caret position in contentEditable or textarea/input element(JavaScript)
/**
* @file get/set caret position and insert text
* @author islishude
* @license MIT
*/
export class Caret {
/**
* get/set caret position
* @param {HTMLColletion} target
*/
@oscarmorrison
oscarmorrison / d3Importer.js
Last active March 6, 2024 12:50
Modularly import only the D3.js modules you require
import { line, curve, curveCatmullRom } from "d3-shape";
import { scaleTime, scaleLinear } from "d3-scale";
import { axisBottom, axisLeft } from 'd3-axis';
import { timeParse, isoFormat } from "d3-time-format";
import { select } from "d3-selection";
import { extent, max, min } from "d3-array";
export default {
line: line,
scaleTime: scaleTime,
@bencates
bencates / svgtest.html
Created June 26, 2014 04:43
Draw a SVG hexagonal grid
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SVG Test</title>
</head>
<body>
<svg id="s" version="1.1"
width="300" height="300"
xmlns="http://www.w3.org/2000/svg">
@karlhorky
karlhorky / grayscale-disable.css
Created August 26, 2012 12:17
Cross-Browser CSS Grayscale
img.grayscale.disabled {
filter: url("data:image/svg+xml;utf8,&lt;svg xmlns=\'http://www.w3.org/2000/svg\'&gt;&lt;filter id=\'grayscale\'&gt;&lt;feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/&gt;&lt;/filter&gt;&lt;/svg&gt;#grayscale");
-webkit-filter: grayscale(0%);
}