Skip to content

Instantly share code, notes, and snippets.

View gazdagergo's full-sized avatar

Gergely Gazda gazdagergo

  • Budapest, Hungary
View GitHub Profile
@mtliendo
mtliendo / fetchFollowerCounts.js
Created October 14, 2020 21:05
retreive a list of followers from twitter
const cheerio = require('cheerio')
const axios = require('axios').default
async function fetchFollowerCounts(usernames) {
const followerData = usernames.map((username) => {
return axios.get(`https://mobile.twitter.com/${username}`).then((res) => {
const $ = cheerio.load(res.data)
const searchContext = `a[href='/${username}/followers']`
const followerCountString = $(searchContext)
.text()
@swyxio
swyxio / Gatsby-bootstrap-lifecycle.md
Last active April 1, 2022 11:19
Gatsby bootstrap lifecycle

Sequence of Gatsby's bootstrap lifecycle with links to source code as of v2.0.0

  1. open and validate gatsby-config (get-config-file.js) 1.5 load themes (swyx added this note July 2019)
  2. load plugins (load-plugins/index.js) from the list given in gatsby-config.js
  3. onPreBootstrap: runs onPreBootstrap if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c9
@nrollr
nrollr / Python.md
Last active June 6, 2023 23:16
Python environments in macOS

Python environments in macOS

The latest version of macOS 10.13.3 has Python 2.7.10 installed by default, yet Python has been available on macOS and previously OS X for quite a while now.

Consult the Apple's Open Source Reference Library, and browse through the various releases of the OS to find out which Python version was included). But what if you have a project which requires Python 3 ?

The following instructions will guide you through the process of:

  • installing Python 3 using Homebrew
  • running multiple Python verions as sandboxed environments
@SKempin
SKempin / Git Subtree basics.md
Last active May 3, 2024 02:57
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@gilbarbara
gilbarbara / react-d3.jsx
Last active September 9, 2020 08:44
React + D3 example
import React from 'react';
import { autobind } from 'core-decorators';
import d3 from 'd3';
import moment from 'moment';
import classNames from 'classnames';
export default class EvolutionChart extends React.Component {
static propTypes = {
investment: React.PropTypes.object.isRequired,
size: React.PropTypes.array,
@shannonmoeller
shannonmoeller / multiline-regexp.js
Last active April 12, 2021 22:16
Multiline Regular Expressions using ES6 Template Strings
/**
* Inspired by XRegExp via 2ality
* http://www.2ality.com/2012/12/template-strings-xregexp.html
* http://xregexp.com/
*/
import test from 'ava';
export function rx(flags) {
const trailingComments = /\s+#.*$/gm;