Skip to content

Instantly share code, notes, and snippets.

View AVVS's full-sized avatar

Vitaly Aminev AVVS

View GitHub Profile
@AVVS
AVVS / conf.coffee
Created March 18, 2013 16:36
Работа с ElasticSearch из node.js
esc = require 'elasticsearchclient'
###
Elastic search module
###
serverOptions =
host: process.env.esHost || 'localhost'
port: 9200
secure: false
@AVVS
AVVS / es.sh
Last active December 15, 2015 11:19
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@AVVS
AVVS / Example.json
Last active December 15, 2015 11:29
{
"Grundfos" : [
{ "name": "GTR", "type": "facility", "children": [
{"name": "Cooling System", "type": "system", "children": [
{"name" : "Pumps", "type" : "assetType", "children": [
{"name": "Heating pump xQ", "type": "asset", "mac": "XX-XX-XX-XX"}
]}
}]
]}
]
mongoose = require 'mongoose'
s = require('validator').sanitize
Schema = mongoose.Schema
ObjectId = Schema.Types.ObjectId
async = require 'async'
a = {"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"","б":"b","ю":"yu"}
transliterate = (word)->
return word.split('').map((char)=>
@AVVS
AVVS / offter.html
Last active December 25, 2015 19:09
<div class="b-offer-item clear_fix" >
<div class="b-offer-item-human">
<img ng-src="{{ offer.owner.photo || offer.owner.photo_50 }}" alt="{{ offer.owner.name || offer.owner.first_name + ' ' + offer.owner.last_name }}">
<p><a href="//vk.com/{{ offer.owner.screen_name }}" target="_blank">{{ offer.owner.name || offer.owner.first_name + ' ' + offer.owner.last_name }}</a></p>
<p class="b-offer-item-human-status">
<span ng-show="offer.owner.online == 1">Online</span>
<span ng-show="offer.owner.online == 0">Offline</span>
</p>
@AVVS
AVVS / user.coffee
Last active December 27, 2015 22:29
app.controller "adminUsersController", [
"$scope"
"$http"
"Restangular"
"$q"
"User"
"UserGet"
($scope, $http, Restangular, $q, User,UserGet) ->
module.exports = function (grunt) {
var files = [
"bower_components/jquery/jquery.js",
"bower_components/lodash/dist/lodash.js",
"bower_components/angular/angular.js",
"bower_components/angular-touch/angular-touch.js",
"bower_components/angular-ui-router/release/angular-ui-router.js",
"bower_components/angular-mocks/angular-mocks.js",
"bower_components/angular-gestures/gestures.js",
@AVVS
AVVS / isHidden.js
Created October 25, 2014 15:53
Determine if DOM node is hidden
/**
* Determines if domElement is visible
* @param {Node} domElement - DOM element to assess
* @return {Boolean}
*/
Observer.prototype.isHidden = function (domElement) {
if (!domElement || domElement.offsetParent === null) {
return true;
}
# Install ttfautohint on Ubuntu 12.04 LTS
# @author: Jean Lescure
# 2014/04/23
# Clone ttfautohint git repo to 'tmp' dir and cd into resulting repo folder
cd /tmp
git clone git://repo.or.cz/ttfautohint.git
cd ttfautohint
# Handle bootstrap's dependency: automake
@AVVS
AVVS / gulpfile.js
Created December 10, 2015 12:37
efficient browserify build with external bundles
const gulp = require('gulp');
const gutil = require('gulp-util');
const source = require('vinyl-source-stream');
const buffer = require('gulp-buffer');
const babelify = require('babelify');
const Browserify = require('browserify');
const nodemon = require('gulp-nodemon');
const path = require('path');
const rev = require('gulp-rev');
const revDel = require('rev-del');