Skip to content

Instantly share code, notes, and snippets.

View alundiak's full-sized avatar
👋

Andrii Lundiak alundiak

👋
View GitHub Profile
@alundiak
alundiak / test-cases.md
Last active December 19, 2021 22:15
Variants of npm commands depends on NODE_ENV value
npm install
npm install --omit=dev
npm install --include=dev
npm ci
npm ci --omit=dev
npm ci --include=dev
import React from 'react';
class ChildComponent extends React.Component {
render() {
console.log('ChildComponent render');
// const { childData } = this.props;
const { field1, field2 } = this.props;
return (
<div style={{border: '1px dotted red', margin: '20px'}}>
#!/usr/bin/env bash
# #
# # Install main dependencies on CentOS:
# # Python 3.4.5, CMake 3.10.0, OpenCV 3.3.1
# # Author Andrii Lundiak (landike@gmail.com)
# #
# https://github.com/ageitgey/face_recognition/issues/191
# https://github.com/opencv/opencv/issues/8471
/**
* https://leetcode.com/problems/integer-to-roman/description/
* https://en.wikipedia.org/wiki/Roman_numerals
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
*
* @param {number} num
* @return {string}
*/
function intToRoman(num) {
var base = {
fragment repositoryFragment on Repository {
name
nameWithOwner
description
createdAt
updatedAt
pushedAt
isFork
forks {
totalCount
const apiUrl = 'https://api.github.com/graphql';
export default function getInfo(TOKEN, myArrayOfRepositories) {
let queryBody = createRepositoriesQueryBody(myArrayOfRepositories);
let options = {
method: 'post',
headers: {
'Authorization': `token ${TOKEN}`,
'Content-Type': 'application/json'
},
export default function getInfo(TOKEN, myArrayOfRepositories) {
// let gh = new GitHub(); // unauthenticated client. Can even be used to create a anonymous gist for example
/*
// basic auth. The same as unauthenticated, this approach is limited to GET/POST requests per day.
let gh = new GitHub({
username: 'your-user',
password: 'TBD',
});
*/
const apiUrl = 'https://api.github.com';
export default function getInfo(TOKEN, myArrayOfRepositories) {
myArrayOfRepositories.forEach(function(repository) {
let strUrl = apiUrl + '/repos/' + repository.owner + '/' + repository.name;
let options = {
headers: {
// 'Content-Type': 'application/json', // OPTIONS => GET
// 'Content-Type': 'text/plain', // doesn't matter. Anyway OPTIONS => GET
'Authorization': `token ${TOKEN}`
[{
"owner": "jquery",
"name": "jquery"
}, {
"owner": "jashkenas",
"name": "backbone"
}, {
"owner": "angular",
"name": "angular.js"
}]
@alundiak
alundiak / notifications-fix.js
Created September 2, 2017 19:53
Code to fix github notifications
const apiUrl = 'https://api.github.com';
var url = apiUrl + '/notifications?participating=true&access_token=MY_TOKEN';
fetch(url)
.then(response => response.json())
.then(data => {
console.log(data); // returned array with ONLY one notification, from where I took URL
});