Skip to content

Instantly share code, notes, and snippets.

View spidgorny's full-sized avatar
💭
Building Flutter apps

Slawa Pidgorny spidgorny

💭
Building Flutter apps
View GitHub Profile
@jozsefs
jozsefs / etoro-portfolio-json-export.js
Created January 3, 2020 20:02
etoro portfolio json export
const data = [...document.querySelectorAll('.ui-table-row')].map(row => ({
market: row.querySelector('.table-first-name').innerText,
units: +row.querySelector('[data-etoro-automation-id=portfolio-overview-table-cell-container-units]').innerText.split('\n')[0].replace(/,/g, ''),
avgOpen: +row.querySelector('[data-etoro-automation-id=portfolio-overview-table-cell-container-open-rate]').innerText,
invested: +row.querySelector('[data-etoro-automation-id=portfolio-overview-table-cell-container-invested]').innerText.slice(1).replace(/,/g, ''),
pl$: +row.querySelector('[data-etoro-automation-id=portfolio-overview-table-cell-container-container-profit]').innerText.replace(/[<,$]/g, ''),
plPercent: +row.querySelector('[data-etoro-automation-id=portfolio-overview-table-cell-container-gain]').innerText.replace(/[<,%]/g, ''),
value: +row.querySelector('[data-etoro-automation-id=portfolio-overview-table-cell-container-equity]').innerText.replace(/[<,$]/g, '')
}));
@chris
chris / mysql_ip_address_info.sql
Last active February 22, 2024 05:49
Get list of IP addresses connected to MySQL DB, with their connection counts
SELECT
tmp.ipAddress,
-- Calculate how many connections are being held by this IP address.
COUNT( * ) AS numConnections,
-- For each connection, the TIME column represent how many SECONDS it has been in
-- its current state. Running some aggregates will give us a fuzzy picture of what
-- the connections from this IP address is doing.
FLOOR( AVG( tmp.time ) ) AS timeAVG,
@sachinKumarGautam
sachinKumarGautam / debounce.js
Created July 18, 2018 11:39
How to use debounce function in react without lodash
function debounce (fn, time) {
let timeoutId
return wrapper
function wrapper (...args) {
if (timeoutId) {
clearTimeout(timeoutId)
}
timeoutId = setTimeout(() => {
timeoutId = null
@princebot
princebot / install_wormhole.bat
Created July 29, 2017 17:44
Install Python magic-wormhole on Windows.
::
:: This script installs wormhole (https://github.com/warner/magic-wormhole) and
:: its prerequisites. Run this as an administrator.
::
:: Install chocolatey.
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
:: Install Python 3.
choco install -y python
@ar-android
ar-android / Download.php
Created July 7, 2017 07:13
Download file using guzzle
<?php
class Download {
public function download($url, $name, $extensions){
$path = __DIR__.'/download/' . $name . $extensions;
$file_path = fopen($path,'w');
$client = new \GuzzleHttp\Client();
$response = $client->get($url, ['save_to' => $file_path]);
return ['response_code'=>$response->getStatusCode(), 'name' => $name];
}
pipeline {
agent any
stages {
stage('Prepare') {
steps {
sh 'composer install'
sh 'rm -rf build/api'
sh 'rm -rf build/coverage'
sh 'rm -rf build/logs'
@malko
malko / urlBase64ToUint8Array.js
Created March 31, 2017 12:58
used in pushManager.Subscribe to correctly encode the key to a Uint8Array
function urlBase64ToUint8Array(base64String) {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/')
;
const rawData = window.atob(base64);
return Uint8Array.from([...rawData].map((char) => char.charCodeAt(0)));
}
@tylerneylon
tylerneylon / .block
Last active May 3, 2024 01:21
Quick js code to draw math functions in an SVG element.
license: mit
@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active July 18, 2024 05:36
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@evantoli
evantoli / GitConfigHttpProxy.md
Last active July 20, 2024 03:29
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like: