Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dshster
dshster / .bowerrc
Created February 9, 2015 19:55
gulp-bower-concat
{
"directory": "Scripts/Components"
}
@dshster
dshster / gist:d77a3b660590bd4ab4e1
Last active August 29, 2015 14:06
callbackhunter popup fire
down = document.createEvent("MouseEvents");
down.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
document.getElementById('clbh_phone_div').dispatchEvent(down)
up = document.createEvent("MouseEvents");
up.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
document.getElementById('clbh_phone_div').dispatchEvent(up)
@dshster
dshster / gulpfile.js
Created July 6, 2014 09:30
Gulp less basic task
/* global require */
'use strict';
var gulp = require('gulp'),
less = require('gulp-less');
gulp.task('less', function() {
gulp.src('styles/less/bootstrap.less')
.pipe(less({
compress: true
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) {
@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(''));
}
};
@dshster
dshster / resize.jsx
Last active August 29, 2015 14:02
Скрипт уменьшения изображений в Adobe Photoshop для публикации в веб
#target photoshop
app.bringToFront();
$.localize = true;
var target_size = 999;
var tmp_target_size = target_size * 2;
var inputFolder = Folder.selectDialog("Выберите папку с фотографиями");
@dshster
dshster / grid.svg
Created December 14, 2012 05:38 — forked from pepelsbey/grid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dshster
dshster / grunt.js
Created November 21, 2012 18:43 — forked from vojtajina/grunt.js
Grunt script for inlining AngularJS templates
module.exports = function(grunt) {
grunt.initConfig({
inline: {
'index.html': ['tpl/*.html']
}
});
grunt.registerMultiTask('inline', 'Inline AngularJS templates into single file.', function() {
var SCRIPT = '<script type="text/ng-template" id="<%= id %>"><%= content %></script>\n';
@dshster
dshster / gist:4126744
Created November 21, 2012 18:37 — forked from ajpiano/gist:2570733
grunt "indexcss" task
grunt.registerMultiTask("cssindex", "Create an 'index' file of css @import rules for sitewide CSS", function() {
var file = grunt.file;
var target = this.target;
var fileHandles = this.data.map(function( glob ) {
return file.expand( glob );
});
var imports;
fileHandles = fileHandles.concat.apply( [], fileHandles );
@dshster
dshster / 1.1_directory_structure.txt
Created November 21, 2012 18:32 — forked from latentflip/1.1_directory_structure.txt
In Lieu of doing this properly
./frontend
├── /coffee
│   ├── /models
│   | └── MyBaseModel.coffee
│   | └── MyModel.coffee
│   ├── /routers
│   | └── MyRouter.coffee
│   ├── /templates
| │   ├── /tmpl-dir1