Skip to content

Instantly share code, notes, and snippets.

@petromath77
petromath77 / checking DOM
Last active December 20, 2018 08:25
dynamic checking DOM
//old version, works not correctly
$(document).on('DOMNodeInserted', function (e) {
if ($('.new')) {
$('.but').attr("disabled", true);
alert('!!!');
}
});
$(document).on('DOMNodeRemoved', function (e) {
@petromath77
petromath77 / my-module.js
Created December 1, 2018 15:11
my-module.js
var myModule = (function() {
//listening events
var _setUpListeners = function() {
};
//initialize module
return {
init: function() {
@petromath77
petromath77 / ajax snippet
Created November 25, 2018 17:42
ajax snippet
$.ajax({
url: '/path/to/file',
type: 'default GET (POST)',
dataType: 'default: Intelligent Guess (json, script, xml)',
data: {param1: 'value1'},
})
.done(function(){
console.log('success');
})
.fail(function(){
@petromath77
petromath77 / svg sprite
Last active November 19, 2018 19:26
gulp svg sprite
var svgSprite = require("gulp-svg-sprites");
gulp.task('sprites', function () {
return gulp.src('assets/svg/*.svg')
.pipe(svgSprite())
.pipe(gulp.dest("assets"));
});
@petromath77
petromath77 / transition
Created November 18, 2018 17:04
transition sass mixin
//usage: @include shift([property],[duration],[easing]);
@mixin shift($property: all, $duration: .3s, $ease: linear){
-webkit-transition: $property $duration $ease;
-moz-transition: $property $duration $ease;
-o-transition: $property $duration $ease;
transition: $property $duration $ease;
}
@petromath77
petromath77 / gulpfile
Created November 15, 2018 19:42
gulpfile (only sass rendering!)
var gulp = require('gulp'),
sass = require('gulp-sass'),
browsersync = require('browser-sync'),
autoprefixer = require('gulp-autoprefixer'),
notify = require('gulp-notify');
gulp.task('browser-sync', function() {
browsersync({
port: 9000,
@petromath77
petromath77 / bg_parallax
Created October 14, 2018 20:14
Parallax Background
$(window).scroll(function(){
var hScroll = $(this).scrollTop();
//console.log(hScroll);
$('.logo').css({
'transform': 'translate(0px, '+ hScroll/4 +'%)'
});
$('.station').css({
'transform': 'translate(0px, '+ hScroll/6 +'%)'
});
$('.cosmo').css({
@petromath77
petromath77 / Placeholder Sass
Created October 6, 2018 07:50
Customize Placeholder Sass
@mixin placeholder()
input::-webkit-input-placeholder
@content
input:-moz-placeholder
@content
input::-moz-placeholder
@content
input:-ms-input-placeholder
@content
@petromath77
petromath77 / bootstrap-cdn.html
Created August 30, 2018 12:22 — forked from planetoftheweb/bootstrap-cdn.html
Bootstrap 4 CDN template with Font Awesome
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script defer src="https://use.fontawesome.com/releases/v5.0.2/js/all.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- ADDITIONAL STYLESHEET HERE -->
<title>SITE NAME</title>
</head>
@petromath77
petromath77 / hexagon background css
Created August 9, 2018 14:23
hexagon background css
https://codepen.io/rulincab/pen/jKBjzJ
https://codepen.io/tilenp/pen/XadxPo