Skip to content

Instantly share code, notes, and snippets.

View devishot's full-sized avatar

Stamkulov Sattar devishot

View GitHub Profile
@devishot
devishot / create_react_app__babel_relay.js
Last active November 25, 2018 18:21
Fix for new version of "babel-preset-react-app": "^6.1.0". Original script was taken from https://hackernoon.com/using-create-react-app-with-relay-modern-989c078fa892
const fs = require('fs');
const path = require('path');
const file = path.resolve('./node_modules/babel-preset-react-app/create.js');
var text = fs.readFileSync(file, 'utf8');
if (!text.includes('babel-plugin-relay')) {
if (text.includes("require('babel-plugin-macros'),")) {
text = text.replace(
"require('babel-plugin-macros'),",
@devishot
devishot / log15_gelf_handler.go
Last active December 7, 2017 09:51
Gelf with log15 UPD: use go-gelf.v2 by Graylog2
package gelflog15
import (
"os"
"strconv"
"strings"
"gopkg.in/inconshreveable/log15.v2"
"gopkg.in/Graylog2/go-gelf.v2/gelf"
)
@devishot
devishot / Program.cs
Created December 15, 2016 20:41
Synergy + AD + Exchange APIs mix
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Exchange.WebServices.Data;
using System.Net;
using System.Web;
using System.Net.Security;
@devishot
devishot / ios_mvvm_pop.playground
Created December 9, 2016 10:12
iOS MVVM with POP
//: Playground - noun: a place where people can play
import UIKit
protocol PaginatedDataStateProtocol {
var items: [NSObject] { get set }
var page: Int { get set }
var isFetching: Bool { get set }
@devishot
devishot / react_ideas
Created April 30, 2015 10:40
React Ideas: 1. common Form with custom buttons via React's childs; 2. get inside functions of Component as specials functions in props that Component should call them on didMount
__________________________________________________________
onAccept(value) {
to do smth with value
}
this.getValue = answerFunc
(
<ApplicationForm data={_data} handler={[['text', handler]]} getMeYourGetValueFunc={saveGetValueFunc}>
<Buttons>
@devishot
devishot / bashrc
Last active August 29, 2015 14:02
~/.bashrc hacks to Git-branch and pretty console. Preview: http://s1.postimg.org/5s2i1arsv/new_bashrc.png From cool-stuff of Mail.ru: http://habrahabr.ru/company/mailru/blog/145008/
# setup color variables
color_is_on=
color_red=
color_green=
color_yellow=
color_blue=
color_white=
color_gray=
color_bg_red=
color_off=
# Русский перевод для https://github.com/plataformatec/devise/tree/v3.2.4
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n
ru:
devise:
confirmations:
confirmed: "Ваша учётная запись подтверждена."
send_instructions: "В течение нескольких минут Вы получите письмо с инструкциями по подтверждению Вашей учётной записи."
send_paranoid_instructions: "Если Ваш адрес email есть в нашей базе данных, то в течение нескольких минут Вы получите письмо с инструкциями по подтверждению вашей учётной записи."
failure:
@devishot
devishot / mini_magick#get_dominant_color.rb
Last active August 29, 2015 13:57
example of how to convert image to "-format %c histogram:info:" (http://www.imagemagick.org/Usage/files/#histogram) by gem "mini_magick". It used below to get dominant color of image by this solution for ImageMagick http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=12033
require "mini_magick"
module MiniMagick
class Image
def get_dominant_color
color = run_command("convert", path, "-format", "%c\n", "-colors", 1, "-depth", 8, "histogram:info:").split(' ');
# color = " 1764000: (208,195,161) #D0C3A1 srgb(208,195,161)\n\n"
{
hex: color[2],
rgb: color[1][1..-2].split(',')
@devishot
devishot / Google Docs - Spreadsheet Parser
Created January 5, 2014 07:12
Parse Google Form answers in SpreadSheets to separated Documents
var numberInPage1 = 7; //Number of questions in Page 1
var numberInPage2 = 6;
var numberInPage3 = 7;
var parsedColor = '#ff0000'
// Define a custom Paragraph style.
var parStyle = {};
parStyle[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT]
= DocumentApp.HorizontalAlignment.CENTER;