Skip to content

Instantly share code, notes, and snippets.


Mykhailo Krainik mikhail-krainik

View GitHub Profile
mikhail-krainik /
Created Oct 19, 2022
Quicksort algorithm implemented on rust
pub fn quick_sort<T: Clone + PartialOrd>(arr: &[T]) -> Vec<T> {
if arr.len() <= 1 {
return arr.to_vec();
if arr.len() == 2 {
let a = arr[0].clone();
let b = arr[1].clone();
return if a < b { vec![a, b] } else { vec![b, a] };
mikhail-krainik /
Last active Nov 4, 2022
Find 3 most popular keywords from user search history #hash #rust #search
use std::collections::HashMap;
const TOP_COUNT: usize = 3;
type CountMap<'a> = HashMap<&'a str, usize>;
fn worlds_count<'a>(query: &'a str, keys: &mut CountMap<'a>) {
let words = query.split(" ").map(|c| c.trim()).collect::<Vec<_>>();
for w in words {
mikhail-krainik /
Created Jul 1, 2018
Debugging Rust program via rr + rustgdb
if [[ -z $1 ]]; then
echo 'Set ./target/debug/<programm_name> as argument'
sudo rr record -n $1
sudo rr replay -d rust-gdb ~/.local/share/rr/latest-trace
dalanmiller /
Last active Jun 29, 2020
RethinkDB docker-compose.yml example
IMAGE node:argon
RUN mkdir -p /usr/app
COPY . /usr/app
WORKDIR /usr/app
RUN npm install
fredhsu /
Created Jun 23, 2015
Using Rust/Hyper to do a HTTP Post with JSON
extern crate hyper;
extern crate core;
use std::io::Read;
use hyper::Client;
use hyper::header::Connection;
use hyper::header::Basic;
use hyper::header::Headers;
use core::str::FromStr;
jareware /
Last active Nov 9, 2022
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

chrislongo / gdbinit
Created Aug 14, 2012 — forked from CocoaBeans/gdbinit
.gdbinit - A user-friendly gdb configuration file
View gdbinit
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
# DESCRIPTION: A user-friendly gdb configuration file.
# REVISION : 7.3 (16/04/2010)
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln