Skip to content

Instantly share code, notes, and snippets.

View im-sad's full-sized avatar
🌈
its okay to be gay

Andrew im-sad

🌈
its okay to be gay
View GitHub Profile
@im-sad
im-sad / reset.css
Last active April 10, 2017 22:03
Reset
html,body,div,span,h1,h2,h3,h4,h5,h6,p,img,em,strike,strong,s,b,u,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,menu,nav,section,time,mark,audio,video,main {background:transparent;border:0;font-size:100%;margin:0;padding:0;outline:0;vertical-align:baseline;}
article,aside,details,figcaption,figure,footer,header,nav,section,main,menu {display:block}
html {font-size:10px;overflow-y:scroll;-webkit-tap-highlight-color:transparent;-ms-overflow-style:scrollbar;}
body {font:16px/1.5 Arial, "Helvetica CY", "Nimbus Sans L", sans-serif;font-size:1.6rem;text-align:left;background:#fff;color:#222;}
html, body {height:100%;width:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}
ol, ul {list-style:none}
img {border:none}
svg:not(:root) {overflow:hidden}
@im-sad
im-sad / clearfix.css
Created August 11, 2015 12:47
clearfix(uni)
.clr:after {content:".";display:block;height:0;clear:both;visibility:hidden;}
@im-sad
im-sad / text_reset.css
Created September 25, 2016 16:26
Text reset
.txt ul, .txt ol {margin:1rem;}
.txt ul {list-style:disc}
.txt ol {list-style:decimal}
.txt p {margin-bottom:1rem}
.txt img, .txt iframe, .txt object, .txt embed {height:auto !important;max-width:100%;}
.txt h1, .txt h2, .txt h3, .txt h4, .txt h5, .txt h6 {font-weight:bold;line-height:1.1;margin-bottom:1rem;}
.txt h1 {font-size:2.5rem;}
.txt h2 {font-size:2rem;}
.txt h3 {font-size:1.75rem;}
.txt h4 {font-size:1.5rem;}
@im-sad
im-sad / num.php
Created September 28, 2016 11:24
Numeric ends
<?
/* Склонение числительных */
function numEnd($num, $titles) {
$cases = array(2, 0, 1, 1, 1, 2);
return $num . " " . $titles[($num % 100 > 4 && $num % 100 < 20) ? 2 : $cases[min($num % 10, 5)]];
}
numEnd($resultHours, array('час','часа','часов'));
?>
@im-sad
im-sad / svg-sprite.js
Created October 15, 2016 13:20
Get SVG sprite
//JQ
$.get("svg/sprite.svg", function(data) {
var div = document.createElement("div");
div.innerHTML = new XMLSerializer().serializeToString(data.documentElement);
document.body.insertBefore(div, document.body.childNodes[0]);
});
//JS
var ajax = new XMLHttpRequest();
ajax.open("GET", "svg/sprite.svg", true);
@im-sad
im-sad / jq.html
Created November 19, 2016 16:31
Jquery from Google or local
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script>
@im-sad
im-sad / slick.js
Created December 15, 2016 18:15
Custom Dots for slick.js
/**
* Slick
*/
;(function($) {
$('.slick').slick({
infinite: false,
dots: true,
customPaging: function(slider, i) {
$.fn.extend({
toggleText: function(a, b){
return this.text(this.text() == b ? a : b);
}
});
@im-sad
im-sad / counter.scss
Created August 25, 2018 09:22
CSS counter
ul {
counter-reset: num;
li {
counter-increment: nums;
&:before {content: counter(nums);}
}
}
@im-sad
im-sad / sass-maps-index-iterator.css
Created September 12, 2018 09:58 — forked from juanbrujo/sass-maps-index-iterator.css
sass-maps loop with index iterator
/**
* output from sass-maps-index-iterator.scss
*/
li:nth-of-type(1):before {
content: "english - hello";
}
li:nth-of-type(2):before {
content: "spanish - hola";
}