Skip to content

Instantly share code, notes, and snippets.

View thefasttracker's full-sized avatar

Oleg Novikov thefasttracker

View GitHub Profile
@thefasttracker
thefasttracker / curl.md
Created December 24, 2022 11:10 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@thefasttracker
thefasttracker / countDownLatch
Created November 27, 2022 12:24
Timing concurrent execution Java
// Simple framework for timing concurrent execution
public static long time(Executor executor, int concurrency,
Runnable action) throws InterruptedException {
CountDownLatch ready = new CountDownLatch(concurrency);
CountDownLatch start = new CountDownLatch(1);
CountDownLatch done = new CountDownLatch(concurrency);
for (int i = 0; i < concurrency; i++) {
executor.execute(() -> {
ready.countDown(); // Tell timer we're ready
try {
@thefasttracker
thefasttracker / my-program
Last active August 1, 2022 18:46
Java as a shell script
#!/usr/bin/java --source 11
public class SomeClass {
public static void main(String[] args) {
System.out.println("Hello!");
}
}
/*
To run do:
$ chmod +x my-program
@thefasttracker
thefasttracker / connect.js
Created March 30, 2019 16:01 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@thefasttracker
thefasttracker / Loader.js
Created August 2, 2018 12:14
react preloader spinner
const Loader = () => (
<React.Fragment>
<div id="loading" className="loaderStyle">
<div className="dot"></div>
<div className="msg"></div>
</div>
</React.Fragment>
)
const fetch = require ('node-fetch')
/*-----async function declaration with error handle------*/
async function fetchGithubUser(handle) {
const url = `https://api.github.com/users/${handle}`
const response = await fetch(url)
const body = await response.json()
if (response.status !== 200)
@thefasttracker
thefasttracker / supersearch.html
Created April 13, 2017 11:30 — forked from droganaida/supersearch.html
Search plugin (jQuery, CSS, HTML)
<html>
<head>
<title>BlondieCode. Лайфхаки программиста. Поиск с подстановкой.</title>
<meta charset="utf-8">
<meta name="description" content="BlondieCode. Блог блондинки-программиста. Подписывайся. Здесь много интересного.">
<meta name="keywords" content="BlondieCode, программирование">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@thefasttracker
thefasttracker / CSS - clearfix
Created January 19, 2016 12:38 — forked from kovaldn/CSS - clearfix
CSS - clearfix
.clearfix:before,
.clearfix:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.clearfix:after {
clear: both;
}
@thefasttracker
thefasttracker / main.css
Created January 19, 2016 12:37 — forked from kovaldn/main.css
CSS: footer
<div class="wrapper">
<div class="main-content">
</div>
</div>
<footer class="page-footer">
</footer>
/* прибьём футер к низу*/
.wrapper{