Skip to content

Instantly share code, notes, and snippets.

@Rigel772
Rigel772 / better.thml
Last active April 15, 2020 10:27
[HTML5 drag and drop]
https://stackoverflow.com/questions/44415228/list-sorting-with-html5-dragndrop-drop-above-or-below-depending-on-mouse
here is full, better (probably) solution for lists
@Rigel772
Rigel772 / descr.txt
Last active April 15, 2020 02:53
[HTML editable content]
https://stackoverflow.com/questions/50876234/save-changes-made-by-content-editable-on-any-website
!!! basically to make text editable you need to add contenteditable="true" attribute (firefox only)!!!
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content
@Rigel772
Rigel772 / description.txt
Created April 15, 2020 02:21
[HTML context menu] (mozilla only)
With a base menu tag with the type of context and id to match the context attribute for the blog it's to be used for, menu items or submenus may be created. Menu items may have label, icon, and onclick attributes to represent design and actions. Actions can have predefined functions or inline javascript code, just as any element can. Multiple parents can use the same menu, so no need to repeat the same menus.
@Rigel772
Rigel772 / index.html
Created April 9, 2020 20:27
[Sticky navbar (with js)] #css #html #js
<div id="navbar">
<a href="#home">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
</div>
@Rigel772
Rigel772 / index.html
Last active April 9, 2020 20:18
[Side nav - sticky, smooth, active] #css
https://css-tricks.com/sticky-smooth-active-nav/
<header>
<h1>Website</h1>
</header>
<nav>
<ul>
<li><a href="#section-1">Section 1</a></li>
<li><a href="#section-2">Section 2</a></li>
@Rigel772
Rigel772 / outline.css
Created April 8, 2020 22:37
[elements outline] #css
* { outline: 1px red solid !important; visibility: visible !important }
@Rigel772
Rigel772 / Array.from.js
Created April 8, 2020 21:24
[Array methods] #js
// This change all thing that are array-like or iterable into true array especially when working with DOM, so that you can use other array methods like reduce, map, filter and so on.
const name = 'frugence';
const nameArray = Array.from(name);
console.log(name); // output: frugence
console.log(nameArray); // output: ['f', 'r', 'u', 'g', 'e', 'n', 'c', 'e']
//working with DOM
@Rigel772
Rigel772 / filter1.js
Last active April 8, 2020 21:14
[How to filter an array with array] #js
//PROBLEM
//Input:
//array1 = [a, b, c, d, e]
//array2 = [b, d, f]
//Output:
//array1 = [a, c, e]
//array2 = [b, d, f]
@Rigel772
Rigel772 / header.css
Created April 8, 2020 20:08
[Header breaker - title with line in the middle] #css
<section class="about">
<div class="about__header header-breaker">
<p>about us</p>
</div>
</section>
.header-breaker {
margin: 3rem auto;
@Rigel772
Rigel772 / center.css
Last active April 8, 2020 20:10
[center element] #css
// CENTER
@mixin center($position) {
position: absolute;
@if $position == 'vertical' {
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}