Skip to content

Instantly share code, notes, and snippets.

View xto3na's full-sized avatar

Sergey Ponomarenko xto3na

  • Dnepropetrovsk, Ukraine
View GitHub Profile
@xto3na
xto3na / KeyframesExplosionAnimation(Emmet).html
Last active February 7, 2017 09:12
Keyframes Explosion Animation
.particle*400
@xto3na
xto3na / Regexp for id from url
Created January 18, 2017 12:59
Regexp for id from url
/[^\.*+product_id=][0-9*].*/
Чтоб достать id из строки '/index.php?route=product/product&product_id=1643' // Результат - '1643'
@xto3na
xto3na / Typescript - multidimensional array initialization
Created December 22, 2016 01:33
Typescript - multidimensional array initialization
class Something {
private things: Thing[][];
constructor() {
things = [];
for(var i: number = 0; i < 10; i++) {
this.things[i] = [];
for(var j: number = 0; j< 10; j++) {
this.things[i][j] = new Thing();
@xto3na
xto3na / REDIRECT for Web.config
Created December 18, 2016 11:36
REDIRECT for Web.config
<!-- Redirect -->
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect" stopProcessing="true">
<match url=".*" />
<action type="Redirect" url="http://not-found.com/" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
@xto3na
xto3na / Upload input Styling
Last active November 24, 2016 14:56
Upload input Styling
<label class="file_upload">
<span class="button">Choose</span>
<mark>The file is not selected</mark>
<input type="file"/>
</label>
<style>
// File upload inputs styles
.file_upload{
background: #fff;
@xto3na
xto3na / Select validation required
Created September 19, 2016 15:22
Select validation required
<select class="required day" name="profileInputId_29412">
<option value="0">Выберите день *</option>
<option value="1">Пятница 19-22</option>
<option value="2">Суббота 19-22</option>
</select>
<script>
document.addEventListener("DOMContentLoaded", function(){
$("#sub_form").validate({
@xto3na
xto3na / Date input format
Created September 14, 2016 08:53
Date input format
$(".date-of-birth").on("blur", function () {
var str = $(".date-of-birth").val();
$(".date-of-birth").val(str.replace(/[^\/0-9]/g,''));
});
@xto3na
xto3na / CSS check input for non-empty
Created September 9, 2016 08:39
CSS check input for non-empty
input[type="text"]:not(:placeholder-shown) {
border-color: #4F4F4F;
}
@xto3na
xto3na / CSS Scroll Indicator
Created August 6, 2016 19:31
CSS Scroll Indicator
<header>
<h1>Scroll Indicator</h1>
</header>
<main>
<h2>I was interested to see if I could make a scroll indicator <a href="http://codepen.io/derekjp/pen/pJzpxB" target="_blank">like this</a> with just CSS.</h2>
<p>You can! But maybe you shouldn't. This is an interesting consequence of a bunch of hacks held together with duct tape. It uses z-index hacks, gradient hacks and tricks with calc and viewport units.</p>
<p>Having said that, hacks are not always bad. I love hacks and many of us have made quite a good living selling floats and clearfixes.</p>
<p>The techniques used here are well supported, if not conventional. If you can read the CSS, understand how it works, and how to change it, and you think this works better for you than JavaScript, feel free to implement it. Just be aware of the z-index behaviour and possible conflict with other CSS using negative z-index.</p>
<hr>
<p>Cras mattis consectetur purus sit amet fermentum. Donec id elit non mi porta gravida at eget metus. Donec id elit non mi po
@xto3na
xto3na / SWIPE
Created July 27, 2016 12:32
SWIPE
$.fn.touchScrolling = function(){
var startPos = 0,
self = $(this);
self.bind('touchstart', function(event) {
console.info("touchstart, target: ", event.target);
var e = event.originalEvent;
startPos = self.scrollTop() + e.touches[0].pageY;
e.preventDefault();
});