Skip to content

Instantly share code, notes, and snippets.

@freearhey
freearhey / server.js
Last active February 17, 2019 13:15
Прокси к Twitter Search API
require('dotenv').config();
var Twitter = require('twitter');
var http = require('http');
var fs = require('fs');
var url = require('url');
// Указываем коды доступа к Twitter API
var client = new Twitter({
consumer_key: process.env.CONSUMER_KEY,
@freearhey
freearhey / collection.xml
Created August 31, 2016 05:45
Использование vue.js в XSLT шаблоне
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="template.xsl" type="text/xsl" ?>
<collection />
@freearhey
freearhey / app.js
Created November 22, 2016 14:39
Изменение номера страницы в адресной строке с помощью vue-router
var appId = UNSPLASH_APP_ID_HERE
// создаем новый экземпляр vue-router
var router = new VueRouter()
new Vue({
el: '#app',
// подключаем router к vue
router,
data: {
@freearhey
freearhey / App.vue
Created January 13, 2017 14:23
Подключение глобальных Scss-файлов
<template>
<div id="app">
Привет, SASS!
</div>
</template>
<script>
export default {
name: 'app'
}
@freearhey
freearhey / main.js
Created January 13, 2017 15:48
Добавление scss-файлов в проект
// Для работы так же необходимо установить соответствующие webpack загрузчики
// npm install style-loader css-loader node-sass sass-loader --save-dev
var Vue = require('vue')
require('style!css!sass!./style.scss')
new Vue({
el: '#app'
})
@freearhey
freearhey / gist:72c77e40015aab21e06ec6cbcfd7223f
Created January 29, 2017 22:52 — forked from realmyst/gist:1262561
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@freearhey
freearhey / main.js
Created March 6, 2017 00:33
Пример с подключением компонента во Vue 2 через функцию render
var Vue = require('vue')
var hello = require('./components/hello.vue')
new Vue({
el: 'body',
render: function(createElement) {
return createElement(hello)
}
})
@freearhey
freearhey / Preferences.sublime-settings
Last active April 2, 2017 20:35
Настройки Sublime Text 3
{
"binary_file_patterns":
[
"node_modules/"
],
"color_scheme": "Packages/Material Theme/schemes/Facebook.tmTheme",
"font_options":
[
"subpixel_antialias"
],
@freearhey
freearhey / dependecies.json
Created April 22, 2017 18:24
Полный список зависимостей vue-loader
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.18.0",
"css-loader": "^0.25.0",
"vue-html-loader": "^1.2.3",
"vue-style-loader": "^1.0.0"
@freearhey
freearhey / topics.json
Created January 16, 2019 06:13
YouTube channel's topics list
[
{
"id": "/m/04rlf",
"label": "Music"
},
{
"id": "/m/05fw6t",
"label": "Children's music"
},
{