Skip to content

Instantly share code, notes, and snippets.

class FormValidator
attrs:
state: 'validation'
url: 'validation-url'
root: 'root'
options:
msgCls: 'b-input__error-message'
wrapperCls: 'b-input'
@kerbyfc
kerbyfc / remove_branches_by_closed_tickets.coffee
Last active August 29, 2015 14:05
Grunt таска для удаления всех локальных и удаленных git-веток с ссылками на закрытые Redmine-тикеты
grunt = require('grunt')
exec = require("child_process").exec
grunt.loadNpmTasks('grunt-shell')
request = require('request')
cheerio = require('cheerio')
grunt.registerTask 'check_status', (branch) ->
if branch = branch.replace(/^[\s]*|[\s]*$/, '')
@kerbyfc
kerbyfc / swf.js
Last active August 29, 2015 14:07
swf.js allows to create function wrappers easily
var SWF = (function(root){
var errors = {
wrong_instance : "new SWF($0): wrong argument type -> only Function and SWF object are acceptable",
wrong_args : "swf.define($0, $1): wrong argument type -> only non-empty String with Function or SWF object are acceptable",
name_collision : "swf.define($0, $1): name collision -> $0 is reserved",
alias_collision : "swf.makeAlias($0, $1): name collision -> $0.$2 exists",
forbidden : "swf.define($0, $1): forbidden wrapper -> wrapper must return function, but not $2",
@kerbyfc
kerbyfc / b-sign-in.coffee
Last active August 23, 2016 07:40
UI component-oriented micro-framework with finite state machine integration
$ ->
UI.env('login_form.hint_cookie', 'login_first_msg_viewed')
if UI.env('user.authorized')
$.removeCookie UI.env('login_form.hint_cookie')
UI "signInForm",
###*
* FadeIn/Out animation spid
* @type {Number}
@kerbyfc
kerbyfc / Key Bindings - User.json
Last active August 29, 2015 14:15
Sublime Text 3 settings
[
{
"keys": [
"super+t"
],
"command": "tab_filter",
"context": [
{
"key": "setting.command_mode"
@kerbyfc
kerbyfc / rename canary.zsh
Created March 10, 2015 08:54
Rename Google Chrome Canary (also change application name in menu bar) to use with Slate window management tool
perl -pi.bak -e "use open ':std', ':encoding(UTF-8)'; s/Chrome\"/Chrome Canary\"/g" /Applications/Google\ Chrome\ Canary.app/Contents/Resources/ru.lproj/InfoPlist.strings > /dev/null 2>&1
@kerbyfc
kerbyfc / patch.php
Last active August 29, 2015 14:18
Small php script create file-separated patches with git
#!/usr/bin/env php
<?php
# usage: ./patch kerbyfc origin/devel 'json|yml|js|html|yaml|rb|Gemfile|lock|coffee|png|jpg|ico|gif|txt|scss|css|stylus|cfg|md|map$'
$auth = $argv[1];
$to = $argv[2];
$grep = $argv[3];
$preview_only = $argv[4];
@kerbyfc
kerbyfc / guardian.coffee
Last active August 29, 2015 14:19
Marionette ItemView behavior to prevent navigation and model changes loss
"use strict"
App.Behaviors.Common ?= {}
###*
* Behavior to prevent data loss while navigation, it should be invoked
* with browser history state changes
*
* @note all passed options should be passed to ConfirmDialog view
* @note you should manually destroy view in #accept & #omit methods
@kerbyfc
kerbyfc / fancytree_behavior.coffee
Last active November 30, 2015 17:19
Backbone TreeCollection, FancyTree super class and it's inheritor ReportsTree ItemView class
"use strict"
mousetrap = require "mousetrap"
module.exports = class FancyTreeBehavior extends Marionette.Behavior
###*
* Default options, that should be merged with
* constructor options argument, and then mixed to
* fancytree view
@kerbyfc
kerbyfc / blender.coffee
Last active August 29, 2015 14:22
Blender.js (alfa) - expressed to resolve complex state consistency
(
(root, factory) ->
if typeof define is 'function' and define.amd
# AMD. Register as an anonymous module.
define [], factory
else if typeof exports is 'object'
# Node. Does not work with strict CommonJS, but
# only CommonJS-like environments that support module.exports,
# like Node.