Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@beshur
beshur / placeholder.js
Created March 13, 2013 09:17
jQuery input placeholder fix
placeholderSupport = ("placeholder" in document.createElement("input"));
if(!placeholderSupport ){
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
@beshur
beshur / notifyze.css
Last active December 14, 2015 12:29
jQuery notifyze
// Simple side nofitication
// cc Alex Buznik, 2013
// demo: http://jsfiddle.net/beshur/mr3DV/
.b_notifyze {
position: fixed;
z-index: 110;
top: 0;
right: 0;
}
@beshur
beshur / stuff.css
Created March 4, 2013 10:01
CSS misc stuff
/* misc useful stuff
Alex Buznik (http://buznik.com/) */
.b_catalog {
position: relative;
font: 0/0 a;
}
.b_catalog__el {
position: relative;
@beshur
beshur / gist:5063527
Created March 1, 2013 09:34
PHP generate two different random numbers simple
<?
$present_in = rand(0,4);
$present_in2 = $present_in;
while ($present_in2 == $present_in) {
$present_in2 = rand(0,4);
}
?>
@beshur
beshur / scripts.js
Created November 30, 2012 10:31
jQuery dummy
/* Bankoscopo JS */
var page_var = {
w_w: $(window).width(),
w_h: $(window).height(),
s_t: $("html, body").scrollTop()
}
$(function() {
@beshur
beshur / style.css
Created November 28, 2012 13:46
CSS dummy
/* Cooper Burgers CSS */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
border: 0;
@beshur
beshur / gist:4124512
Created November 21, 2012 11:50
Sublime Text 2 - Useful Shortcuts Windows

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@beshur
beshur / gist:4116813
Created November 20, 2012 08:53 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts MAC

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@beshur
beshur / gist:3898084
Created October 16, 2012 08:42
jQuery registration form validation
$("form.popup [data-validate]").blur(function (e) {
var dv = $(this).attr("data-validate");
if ( $(this).hasClass("error") ) var err_set = true;
var error = 0;
var c = $(this).val();
if ( dv == "email" ) {
var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
@beshur
beshur / gist:3834282
Created October 4, 2012 15:14
jQuery simple form validation
function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
return pattern.test(emailAddress);