Skip to content

Instantly share code, notes, and snippets.

View alpavlove's full-sized avatar

Alexey Pavlov alpavlove

View GitHub Profile
@alpavlove
alpavlove / index.html
Created October 6, 2014 14:41
Controllers communicate to factory
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script data-require="angular.js@*" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script>
<script src="script.js"></script>
</head>
<body>
<div>
@alpavlove
alpavlove / notification_service.js
Created October 23, 2014 09:37
notification_service.js
/* global $, angular, _ */
(function () {
'use strict';
/**
*
* @description: Сервис нотификации
*
actionsByType = {
Client: {
participantId: scope.project.Client.Id,
onHideCallback: function () {
scope.project.Client = {
Id: popupScope.participant.Id,
TypeId: popupScope.participant.Type.Id,
TypeName: popupScope.participant.Type.Name,
Address: popupScope.participant.Address
};
{"type":"object","$schema": "http://json-schema.org/draft-03/schema","id": "http://jsonschema.net","required":false,"properties":{ "Author": { "type":"object", "id": "http://jsonschema.net/Author", "required":false, "properties":{ "DisplayName": { "type":"string", "id": "http://jsonschema.net/Author/DisplayName", "required":false }, "Email": { "type":"string", "id": "http://jsonschema.net/Author/Email", "required":false }, "Id": { "type":"string", "id": "http://jsonschema.net/Author/Id", "required":false }, "Initials": { "type":"string", "id": "http://jsonschema.net/Author/Initials", "required":false } } }, "Id": { "type":"string", "id": "http://jsonschema.net/Id", "required":false }, "Name": { "type":"string", "id": "http://jsonschema.net/Name", "required":false }, "ProjectGroupId": { "type":"string", "id": "http://jsonschema.net/ProjectGroupId", "required":false }, "ProjectTypeId": { "type":"string", "id": "http://jsonschema.net/ProjectTypeId", "required":false } }}
@alpavlove
alpavlove / gist:efd0601668ed5ba76f1a
Created December 22, 2014 13:58
difference between 2 objects
function diff(a,b) {
var r = {};
_.each(a, function(v,k) {
if(b[k] === v) return;
// but what if it returns an empty object? still attach?
r[k] = _.isObject(v)
? _.diff(v, b[k])
: v
;
});
@alpavlove
alpavlove / vertical-align.css
Last active February 22, 2016 07:18
vertical align
/*
<div class="parent">
<div class="child">asdasdasd</div>
<div class="vertical-align"></div>
</div>
*/
.parent {
position: absolute;
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min-resolution: 144dpi) { ... }
@alpavlove
alpavlove / angular2_rxjs_dragabble.directive.ts
Created March 21, 2016 09:15
angular2 rxjs dragabble directive
import { ElementRef, Directive, HostListener, Renderer } from 'angular2/core';
import { Subject } from 'rxjs';
@Directive({
selector: '[draggable]'
})
export class Draggable {
mousedrag;
mouseup = new Subject();
mousedown = new Subject();
@alpavlove
alpavlove / download_egghead_videos.md
Created June 19, 2016 09:18 — forked from ldong/download_egghead_videos.md
download egghead videos

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);