Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrii Lundiak alundiak

View GitHub Profile
View Test.jsx
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'}}>
View install-opencv-3.3.1-in-centos-7.sh
#!/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
View leetcode.js
/**
* 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 = {
View btc-graphql-query.idl
fragment repositoryFragment on Repository {
name
nameWithOwner
description
createdAt
updatedAt
pushedAt
isFork
forks {
totalCount
View btc-index-v4-approach.js
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'
},
View btc-index-v3-github-tools-approach.js
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: 'alundiak',
password: 'TBD',
});
*/
View btc-index-v3-approach.js
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}`
View btc_my-data.json
[{
"owner": "jquery",
"name": "jquery"
}, {
"owner": "jashkenas",
"name": "backbone"
}, {
"owner": "angular",
"name": "angular.js"
}]
@alundiak
alundiak / notifications-fix.js
Created Sep 2, 2017
Code to fix github notifications
View notifications-fix.js
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
});
@alundiak
alundiak / .block
Last active Feb 26, 2017 — forked from mbostock/.block
Bubble Chart
View .block
license: gpl-3.0
height: 880
border: no
You can’t perform that action at this time.