Skip to content

Instantly share code, notes, and snippets.

@dshster
dshster / modslasses.js
Last active August 29, 2015 14:02
bem classes modifiers
(function() {
'use strict';
var delimiter = '--';
DOMTokenList.prototype.modify = function(mod) {
if (false === tag.classList.modified(mod)) {
this.add([this[0], delimiter, mod].join(''));
}
};
HTMLTextAreaElement.prototype.getCaretPosition = function () { //return the caret position of the textarea
return this.selectionStart;
};
HTMLTextAreaElement.prototype.setCaretPosition = function (position) { //change the caret position of the textarea
this.selectionStart = position;
this.selectionEnd = position;
this.focus();
};
HTMLTextAreaElement.prototype.hasSelection = function () { //if the textarea has selection then return true
if (this.selectionStart == this.selectionEnd) {
$vr-font-size: 15px !global;
$vr-line-height: 1.5 !global;
$vr-cap-height: 0.6 !global;
$vr-line-scale: 2 !global;
$vr-grid-unit: $vr-line-height * $vr-font-size / $vr-line-scale !global; // (px)
@function em($px: 0, $font-size: $vr-font-size) {
@return $px / $font-size + em;
}
@sapegin
sapegin / gist:925002
Created April 18, 2011 08:37
CSS3 Buttons in Springhare
/* Button */
button, input[type="submit"] {
display: inline-block;
padding: 2px 20px;
background: #c4c4c4;
background: -webkit-linear-gradient(top, #eee, #c4c4c4);
background: -moz-linear-gradient(top, #eee, #c4c4c4);
background: -ms-linear-gradient(top, #eee, #c4c4c4);
background: -o-linear-gradient(top, #eee, #c4c4c4);
background: linear-gradient(top, #eee, #c4c4c4);
@robertpitt
robertpitt / basic.js
Created July 5, 2012 03:33
Sampel of Oauth flow
/**
* Oauth 2.0 basic example
*/
var express = require('express');
var oauth = require('oauth-server');
/**
* Create a new server
*/
var server = module.exports = express.createServer();
@sapegin
sapegin / main.js
Created July 13, 2012 06:24
Controls helper
/**
* Controls
*
* <span data-trigger="slider-next" data-recipient=".portfolio">Next</span>
*/
$(document).click(function(e) {
var target = e.target;
if (target.getAttribute('data-trigger') && target.getAttribute('data-recipient')) {
target = $(target);
$(target.data('recipient')).trigger(target.data('trigger'));
@sapegin
sapegin / grunt.js
Created August 15, 2012 08:42
Sapegin.me gruntfile
@lazarofl
lazarofl / geocoder_example.html
Created October 16, 2012 18:27
Google Maps V3 - Geocoder example
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Geocoding Simple</title>
<link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
@bennadel
bennadel / http-angularjs.htm
Created April 21, 2014 16:52
Using The $http Service In AngularJS To Make AJAX Requests
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Using The $http Service In AngularJS To Make AJAX Requests
</title>
<style type="text/css">