Skip to content

Instantly share code, notes, and snippets.

View tenphi's full-sized avatar
💭
Try Numl.Design

Andrey Yamanov tenphi

💭
Try Numl.Design
View GitHub Profile
@tenphi
tenphi / nodo-install.log
Created May 28, 2012 10:09
nodo installation error
info it worked if it ends with ok
verbose cli [ 'node', '/usr/local/bin/npm', 'install', '-g', 'nodo' ]
info using [email protected]
info using [email protected]
verbose config file /Users/tenphi/.npmrc
verbose config file /usr/local/etc/npmrc
verbose config file /usr/local/lib/node_modules/npm/npmrc
verbose cache add [ 'nodo', null ]
silly cache add: name, spec, args [ undefined, 'nodo', [ 'nodo', null ] ]
@tenphi
tenphi / 0_reuse_code.js
Last active September 7, 2015 21:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tenphi
tenphi / highlight-css.js
Created September 9, 2015 15:50
highlight all elements with certain css property with jquery
function css( element, property ) {
return window.getComputedStyle( element, null ).getPropertyValue( property ) || '';
}
$('*').each(function(i, el) {
if (~css(el, 'font-family').indexOf('Arial')) {
$(el).css('outline', '1px solid red');
}
});
# install dependecies
brew install imagemagick jpegoptim pngquant
# download images
mkdir images
cd images
wget https://example.com/test_image_01.jpg
wget https://example.com/test_image_02.jpg
wget https://example.com/test_image_03.jpg
wget https://example.com/test_image_01.png
@tenphi
tenphi / tools-for-angularjs-components.txt
Created February 24, 2016 12:42
Set of tools for making AngularJS components
module.component() - Angular's API:
https://docs.angularjs.org/guide/component
angular-bem - A set of directives to simplify your workflow with BEM-markup in AngularJS applications.
https://github.com/tenphi/angular-bem
angular2-bem - A set of directives to simplify your workflow with BEM-markup in Angular 2 applications. (WORK IN PROGRESS)
https://github.com/tenphi/angular2-bem
// active directory group that have editor access to photos
photoEditorsGroup: 'PhotoEditorsAPP.RO',
// Active Directory group names will start with country name, and end with this suffix
countryGroupSuffix: 'PhotoApproverAPP.MOD',
(function(ng) {
'use strict';
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
module.exports = 'tenphi.eventscope';
}
ng.module('tenphi.eventscope', [])
.factory('EventScope', () => {
let listeners = {};
@tenphi
tenphi / angular-dynamic-components.txt
Last active March 16, 2017 17:25
Angular Dynamic Components Link
Presentation - *скоро появится*
*ngComponentOutlet Example - http://plnkr.co/edit/yscxeoYZ0Cfnzzk6Hgu7?p=preview
ComponentInjector Module - https://gist.github.com/tenphi/94b8732d894ce7cec088738c7201e79e
Полезные доклады про Angular:
The Angular 2 Compiler Tobias Bosch - https://youtu.be/kW9cJsvcsGo
Netanel Basal ViewContainerRef - https://netbasal.com/angular-2-understanding-viewcontainerref-acc183f3b682#.t9ip215zn
@tenphi
tenphi / dynamic-component.ts
Created March 16, 2017 13:05
dynamic-component.ts
import { Component, ViewContainerRef, ComponentRef, ComponentFactoryResolver, ViewChild, Type, Input, Compiler } from '@angular/core';
// Helper component to add dynamic components
@Component({
selector: 'tnp-component-injector',
template: `<div></div>`
})
export class ComponentInjector {
@Input() component: Type<Component>;
@Input() props: Object = {};
@tenphi
tenphi / bemnames.js
Created September 2, 2017 11:25
BEM-class Generator for React
import classNames from 'classnames';
// modName -> mod_name
function toKebabCase(str) {
return str ? str.replace(/[A-Z]/g, function(s) {return '-' + s.toLowerCase() }).replace(/$\-/, '') : '';
}
function BEM(blockName) {
blockName = blockName || '';