Skip to content

Instantly share code, notes, and snippets.

View neolite's full-sized avatar
💭
I may be slow to respond.

Rafkat Galiullin neolite

💭
I may be slow to respond.
View GitHub Profile
@neolite
neolite / print.js
Created July 24, 2017 15:40 — forked from cchitsiang/print.js
JavaScript Print: Bypass Printer Dialog in IE and Firefox
var OLECMDID = 6;
/* OLECMDID values: * 6 - print * 7 - print preview * 1 - open window * 4 - Save As */
if (navigator.appName == "Microsoft Internet Explorer")
{
var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
if(PrintCommandObject)
{
try
{
var path = require('path')
var config = require('../config')
var utils = require('./utils')
var projectRoot = path.resolve(__dirname, '../')
var env = process.env.NODE_ENV
// check env & config/index.js to decide whether to enable CSS source maps for the
// various preprocessor loaders added to vue-loader at the end of this file
var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
@neolite
neolite / webpack.base.conf.js
Created February 2, 2017 09:59 — forked from vedovelli/webpack.base.conf.js
webpack base config for vue cli with support for Bootstrap and Font-awesome
var path = require('path')
module.exports = {
entry: {
app: './src/main.js'
},
output: {
path: path.resolve(__dirname, '../dist/static'),
publicPath: '/static/',
filename: '[name].js'
@neolite
neolite / Capistrano 3.md
Created January 28, 2017 15:19 — forked from stevenyap/Capistrano 3.md
Capistrano 3 Setup

This guide explains the way to setup a production server using Capistrano.

Setup Capistrano on LOCAL

  • Capistrano is a development gem which assist the developer to run commands on the production server (something like a Heroku toolbelt)
  • Hence, it is installed and configured on developer's computer
# Gemfile

# Use Capistrano for deployment
@neolite
neolite / bot.cr
Created April 18, 2016 13:29
Простой бот на кристалле
require "TelegramBot"
class MyBot < TelegramBot::Bot
include TelegramBot::CmdHandler
def initialize
super("MyBot", "12345678:T0K3N")
cmd "hello" do |msg|
reply msg, "world!"
@neolite
neolite / README.md
Created March 18, 2016 10:14 — forked from segphault/README.md
Pipe data from a RethinkDB changefeed into Plotti

RethinkDB Changfeeds and Plottico

This example shows how to take the output of a RethinkDB changefeed and send it to Plottico, a microservice that generates embeddable streaming graphs. This example uses Plottico's hosted infrastructure, but you can also self-host your own Plottico server using the code from Plottico's GitHub repository.

# 5 состоянии:
# – draft (созданный)
# – moderation (на модерации у админа)
# – prerelease (админ одобрил, и ждет "ок, полетели")
# – published (обпуликован)
# – отменен (модератор отменил пост после правок админом)
class PostPolicy < ApplicationPolicy
# создавть пост могут 2 типа пользователя
@neolite
neolite / put_method.js
Created November 10, 2015 12:28 — forked from Unitech/put_method.js
Timeseries spec proposal / RethinkDB
var timeseries = require('timeseries');
var incoming_data = {
client : 2,
events_1sec : 10,
events_1min : 65
};
/**
* The timeseries module must be state-less
@neolite
neolite / log.js
Created October 15, 2015 13:43
logging frontend errors
window.onerror = function(message, url, lineNumber) {
//save error and send to server for example.
// alert(message, url, lineNumber);
$.post('/log_errors', {
message: message,
url: url,
line: lineNumber
}, function(d) {
console.log("error saving complete: " + d);
});
down = document.createEvent("MouseEvents");
down.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
document.getElementById('clbh_phone_div').dispatchEvent(down)
up = document.createEvent("MouseEvents");
up.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
document.getElementById('clbh_phone_div').dispatchEvent(up)