Skip to content

Instantly share code, notes, and snippets.

View danielt69's full-sized avatar
:octocat:
Focusing

Daniel danielt69

:octocat:
Focusing
View GitHub Profile
Add all these. To make in single line.
a {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
width:100px; // some width
}
//To do in multi line which actually you asked.
#content {
<script>
document.onreadystatechange = function () {
if (document.readyState === "interactive") {
var el = document.getElementsByTagName('body');
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName === "class") {
// var attributeValue = mutation.target.prop(mutation.attributeName);
console.log(document.getElementsByTagName('body')[0].classList);
// console.log("Class attribute changed to:", attributeValue);
@danielt69
danielt69 / nextOne.js
Created January 30, 2018 07:29
return next node and first one if it's last
$.fn.nextOne = function(){
return $(this).next().length ? $(this).next() : $(this).parent().children().first();
};
$.fn.prevOne = function(){
return $(this).prev().length ? $(this).prev() : $(this).parent().children().last();
};
@danielt69
danielt69 / outerHeight.js
Created January 30, 2018 07:13
extending jquery outerHeight for array of objects
$.fn.outerHeight = function(bool=false){
var totalHeight = 0;
$(this).each(function(){
totalHeight += $(this).outerHeight(bool);
});
return totalHeight;
}
@danielt69
danielt69 / unicode_mixin.scss
Created August 6, 2017 14:41
unicode fix in sass/scss
// @source - [@Stephn-R](https://github.com/sass/sass/issues/1395#issuecomment-57483844)
// @description converts 1 or more characters into a unicode
// @markup {scss}
// unicode("e655"); // "\e655"
@function unicode($str){
@return unquote("\"")+unquote(str-insert($str, "\\", 1))+unquote("\"")
};
<script>
var Notification = window.Notification || window.mozNotification || window.webkitNotification;
Notification.requestPermission(function (permission) {
// console.log(permission);
});
function show() {
window.setTimeout(function () {
var instance = new Notification(
body { font-family: "Open Sans", Tahoma, sans-serif; line-height: 1.7; color: #111; position: relative; overflow-x: hidden; z-index: 1; background-color: #fff; font-size: calc(14px + .3vw); font-weight: 400; font-family: "Open Sans"; }
h1, h2, h3, h4, h5, h6, .serif { font-weight: 900; line-height: 1.3; margin: 1.5em 0 .75em; }
h1 { font-size: 2.6em; font-weight: 600; margin-top: 0; }
h2 { font-size: 2em; }
h3 { font-size: 1.8em; }
h4 { font-size: 1.4em; }
h5 { font-size: 1.2em; }
h6 { font-size: 1em; }
$('body').on('click',function(e){
var container = $('.categoriesContainer .hiddenCategories .categoriesWrapperList');
if ((!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0)) // ... nor a descendant of the container
{
seeAllBtn.removeClass('openCategoriesPopup');
$('.closeCatPopup').remove();
}
})
function requestFullScreen(element) {
// Supports most browsers and their versions.
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
if (requestMethod) { // Native full screen.
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") { // Older IE.
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
function getRandomColor() {
color = "hsl(" + Math.random() * 360 + ", 100%, 40%)";
return color;
}
// or
function getRandomIntInclusive(min, max) {