Skip to content

Instantly share code, notes, and snippets.

View voronianski's full-sized avatar

Dmytro Voronianski voronianski

View GitHub Profile
@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 / 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 / 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 / CORS_test.html
Last active December 10, 2015 13:59 — forked from bennadel/demo.htm
<!DOCTYPE html>
<html>
<head>
<title>Cross-Origin Resource Sharing (CORS) test</title>
</head>
<body>
<body>
<h2>Test CORS localhost</h2>
<a href="#" class="put">PUT</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
// Basic XMPP bot example for HipChat using node.js
// To use:
// 1. Set config variables
// 2. Run `node hipchat_bot.js`
// 3. Send a message like "!weather 94085" in the room with the bot
var request = require('request'); // github.com/mikeal/request
var sys = require('sys');
var util = require('util');
@voronianski
voronianski / http.js
Created February 18, 2013 20:13 — forked from bsstoner/http.js
/**
* Modified version of TJ's http support file from the Express repo:
* https://github.com/visionmedia/express/blob/master/test/support/http.js
*
* Module dependencies.
*/
var EventEmitter = require('events').EventEmitter
, should = require('should')
, methods = ['get','post','put','delete','head']
/*
Put on top of the file before describe statements
Usage:
expect(fn).toBeFunction()
*/
beforeEach(function (){
this.addMatchers({
toBeFunction: function (){
return Object.prototype.toString.call(this.actual)==='[object Function]';
}