Skip to content

Instantly share code, notes, and snippets.

View voronianski's full-sized avatar

Dmytro Voronianski voronianski

View GitHub Profile
@voronianski
voronianski / Fullpage.html
Created June 20, 2012 14:20
A web page created at CodePen.io
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Color picker &middot; CodePen</title>
<style>
@voronianski
voronianski / jquery.support.cssproperty.js
Created July 14, 2012 13:26 — forked from jackfuchs/jquery.support.cssproperty.js
Extends the jQuery.support object to CSS Properties
/**
* jQuery.support.cssProperty
* To verify that a CSS property is supported (or any of its browser-specific implementations)
*
* @param string p - css property name
* [@param] bool rp - optional, if set to true, the css property name will be returned, instead of a boolean support indicator
*
* @Author: Axel Jack Fuchs (Cologne, Germany)
* @Date: 08-29-2010 18:43
*
@voronianski
voronianski / helper.js
Created July 16, 2012 08:50 — forked from danharper/helper.js
Handlebars Conditional Helper
Handlebars.registerHelper('if_task_active', function(options) {
var state = this.model.state_id;
if (state == 300) {
return options.fn(this);
}
return options.inverse(this);
});
@voronianski
voronianski / serializeObject.js
Created July 16, 2012 08:59
Custom function serializing object to json
/**
* Serializing object function
*/
$.fn.serializeObject = function()
{
var object = {};
var array = this.serializeArray();
$.each(array, function() {
if (object[this.name] !== undefined) {
@voronianski
voronianski / tagged.css
Created August 8, 2012 11:51 — forked from csswizardry/tagged.css
Leaving tags in CSS files to find similar chunks of code
/*------------------------------------*\
$NAV
\*------------------------------------*/
/*
TAGS: ^lists ^navigation ^text
*/
/*
As per csswizardry.com/2011/09/the-nav-abstraction
*/
.nav{
@voronianski
voronianski / placeholder.js
Created August 29, 2012 13:33
Placeholder fallback with jQuery
/**
* Fallback for "Placeholder" attribute in old browsers
* source: http://www.scriptiny.com/2012/08/html5-placeholder-fallback-using-jquery/?utm_source=html5weekly&utm_medium=email
*/
$(document).ready(function() {
if (!('placeholder' in document.createElement('input'))) {
$('input[placeholder]').each(function() {
var val = $(this).attr('placeholder');
@voronianski
voronianski / uri.js
Created September 7, 2012 11:48 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@voronianski
voronianski / html_template.js
Created September 15, 2012 23:33 — forked from danielbeardsley/html_template.js
A template renderer for express.js that processes plain vanilla HTML and has the option to strip newlines.
// Usage:
// express_app.register('html', htmlRenderer({stripNewlines: true}));
// ...
// express_app.get('/plain', function(req, res){
// res.render('./path_to_html_file');
// })
function htmlRenderer(opt){
var stripNewlines = opt && opt.stripNewlines;
@voronianski
voronianski / app.js
Created September 16, 2012 22:24 — forked from flockonus/app.js
swig on express.js 3.0
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http')
, path = require('path')
// !
, swig = require('./config/consolidate-swig').swig
@voronianski
voronianski / hex.randomize.js
Created September 23, 2012 09:53
Returns random hex color
function randomize() {
var letters = '0123456789ABCDEF'.split('');
var color = '#';
for (i = 0; i < 6; i++) {
color += letters[Math.round(Math.random() * 15)];
}
return color
}