Skip to content

Instantly share code, notes, and snippets.

# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@TigorC
TigorC / hover-class.directive.ts
Created February 23, 2017 02:56
Angular 2 hover class directive
import { Directive, Input, HostListener, Renderer, ElementRef } from '@angular/core';
@Directive({ selector: '[hoverClass]' })
export class HoverClassDirective {
@Input()
hoverClass: string;
constructor(
public elementRef: ElementRef,
@TigorC
TigorC / git_flow_example.sh
Created July 14, 2015 15:10
Git flow example
# Создание веток master/developer/release/hotfix
git flow init
# Начинаем работать над функционалом feature1 (ответвление от develop)
git flow feature start feature1
# делаем изменения
git add ...изменения...
git commit -m "изменения для feature1"
# Эта команда сделает слияние feature1 с develop и удалит ветку
@TigorC
TigorC / core.css
Last active August 29, 2015 14:16
CSS tricks
/*placeholder ellipsis*/
input[placeholder] {text-overflow:ellipsis;}
input::-moz-placeholder {text-overflow:ellipsis;}
input:-moz-placeholder {text-overflow:ellipsis;}
input:-ms-input-placeholder {text-overflow:ellipsis;}
/*Hide placeholder in focus*/
:focus::-webkit-input-placeholder {color: transparent}
:focus::-moz-placeholder {color: transparent}
:focus:-moz-placeholder {color: transparent}
@TigorC
TigorC / validation.coffee
Last active August 29, 2015 14:08
Angular 1.3 form validation directives
angular.module("Validation", ["ngMessages"]).constant("validationClassConfig",
validClass: "has-success"
invalidClass: "has-error"
)
.service("formValidation", ->
setDirtyField = (field) ->
field.$setDirty()
localValidateForm: (form) ->
_formValidate = (innerForm) ->
angular.module('reveal.directives', [])
.directive('zurbReveal', function($revealService, $log){
return {
restrict: 'A',
link: function postLink(scope, element, attrs) {
scope.$watch(attrs.zurbReveal, function(url){
if(typeof(url)=='undefined') url = attrs.zurbReveal;
element.bind( "click", function(){
scope.$emit("event:modal-request", url, scope, attrs.revealOptions);
});
@TigorC
TigorC / gist:3787759
Created September 26, 2012 12:32
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@TigorC
TigorC / form_ajax.js
Created August 22, 2012 11:43
Django bootstrap AJAX form
// Для отправки вормы использовать jQuery ajax forms (http://jquery.malsup.com/form/)
// Показывает ошибки формы
function show_form_errors(form, error_json)
{
clear_form_errors(form);
for (name in error_json) {
var elem = form.find('input[name=' + name + '], textarea[name=' + name + ']');
elem.closest('.control-group').addClass('error');
elem.parent().prepend($('<span class="help-inline">*' + error_json[name] + '</span>'));
}
@TigorC
TigorC / tastypie_resource.py
Created July 18, 2012 10:29
Example of a custom django-tastypie Resource
from tastypie import fields
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
from tastypie.bundle import Bundle
from tastypie.exceptions import NotFound
from tastypie.resources import Resource
# a dummy class representing a row of data
class Row(object):