Skip to content

Instantly share code, notes, and snippets.

View hero9's full-sized avatar
:shipit:
Focusing

Galymzhan Almabek hero9

:shipit:
Focusing
  • Openmatics
  • Prague
  • 13:52 (UTC +02:00)
View GitHub Profile
@hero9
hero9 / useExportExcel.ts
Last active April 19, 2022 10:53
React custom hook, which exports data to excel!
import * as XLSX from 'xlsx';
import FileSaver from 'file-saver';
// Pass tree: true if want to get excel with multiple pages
export const useExportData = (fileName: string, csvData: any, tree?: boolean) => {
let ws: XLSX.WorkSheet;
const fileType =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
const fileExtension = '.xlsx';
Step 1: On the front-end, get the 3rd party authentication provider login popup to appear.
Step 2: (Still on the front-end) Grab the access token the provider returns after agreeing to login.
Step 3: (Yep, still front-end) Send that token to the back-end as part of the input argument of your mutation.
Step 4: On the back-end, verify the token.
Step 5: If the token is authentic, you will receive the user as part of the verification response (at least that’s the case with Passport.js, which we’ll be using).
@hero9
hero9 / Git push deployment in 7 easy steps.md
Created August 29, 2019 06:11 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@hero9
hero9 / SSL.md
Created January 9, 2019 05:09 — forked from gangsta/SSL.md
How to Setting Up a Comodo SSL Cert

How to Setting Up a Comodo SSL Cert

I advice you to buy SSL Certs from officially Comodo only , or some SSL reseller whose you trust.

These are the steps I went through to set up an SSL cert. Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You’ll be asked for the content of the CSR file when ordering the certificate.

formatDays = function (d) {
var days = Math.floor(d / 86400),
hours = Math.floor((d - (days * 86400)) / 3600),
minutes = Math.floor((d - (days * 86400) - (hours * 3600)) / 60),
seconds = d - (days * 86400) - (hours * 3600) - (minutes * 60);
var output = '';
if (seconds) {
output = seconds + 's';
}
if (minutes) {
@hero9
hero9 / gist:82f9f8398fc8fe3531b93bf4060a501f
Created July 20, 2018 10:45 — forked from molivier/gist:271bba5d67de1583a8e3
Set $GOPATH on Mac OSX : bash_profile
# Edit ~/.bash_profile
export GOPATH=/Users/username/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile
#!/bin/bash
sudo apt update &&
sudo apt upgrade -y &&
#---GDEBI---
sudo apt install -y gdebi &&
#---SOFTWARE-PROPERTIES-COMMON for adding third-party repos
sudo apt install -y software-properties-common &&
#---Elementary Tweaks---
sudo add-apt-repository -y ppa:philip.scott/elementary-tweaks &&
sudo apt update &&
@hero9
hero9 / gulp_tasks
Created April 8, 2018 09:09
Gulp tasks
var gulp = require('gulp'), // Подключаем Gulp
sass = require('gulp-sass'), //Подключаем Sass пакет,
browserSync = require('browser-sync'), // Подключаем Browser Sync
concat = require('gulp-concat'), // Подключаем gulp-concat (для конкатенации файлов)
uglify = require('gulp-uglifyjs'), // Подключаем gulp-uglifyjs (для сжатия JS)
cssnano = require('gulp-cssnano'), // Подключаем пакет для минификации CSS
rename = require('gulp-rename'), // Подключаем библиотеку для переименования файлов
del = require('del'), // Подключаем библиотеку для удаления файлов и папок
imagemin = require('gulp-imagemin'), // Подключаем библиотеку для работы с изображениями
pngquant = require('imagemin-pngquant'), // Подключаем библиотеку для работы с png
@hero9
hero9 / Gulpfile.js
Created April 3, 2018 15:18 — forked from webdesserts/Gulpfile.js
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.
@hero9
hero9 / new_gist_file_0
Created March 25, 2018 13:57
mongoDB start
sudo service mongod start