Skip to content

Instantly share code, notes, and snippets.

View mykhailokrainik's full-sized avatar

Mykhailo Krainik mykhailokrainik

View GitHub Profile
@jareware
jareware / SCSS.md
Last active October 21, 2025 14:22
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

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

@fredhsu
fredhsu / eapi.rs
Created June 23, 2015 21:24
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;
@dalanmiller
dalanmiller / Dockerfile.app
Last active June 29, 2020 15:27
RethinkDB docker-compose.yml example
IMAGE node:argon
RUN mkdir -p /usr/app
COPY . /usr/app
WORKDIR /usr/app
RUN npm install
PostgreSQL Type PostgreSQL Size Description Range Diesel Type Rust Type
Nullable Types nullable Nullable``
@mykhailokrainik
mykhailokrainik / rust-rr-dbg.sh
Created July 1, 2018 10:23
Debugging Rust program via rr + rustgdb
#!/bin/bash
if [[ -z $1 ]]; then
echo 'Set ./target/debug/<programm_name> as argument'
else
sudo rr record -n $1
sudo rr replay -d rust-gdb ~/.local/share/rr/latest-trace
fi
@mykhailokrainik
mykhailokrainik / top_search.rs
Last active November 4, 2022 03:15
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 {
@mykhailokrainik
mykhailokrainik / quick_sort.rs
Created October 19, 2022 18:16
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] };

introduction

inspired by a friend’s fledgling language design and motivated by the JeanHeyd Meneide RustConf Fiasco™ and improving the story for compile-time introspection, i decided i needed a place to spew the last year’s musings on variadic generics in Rust in one mighty, less-than-understandable catharsis.

i think somewhere in here is a considered and reasonable design, so that’s neat!

perhaps i’ll make this an RFC one day. probably not. you have my express permission to do that yourself.

variadic generics?

this nugget of language jargon encapsulates the idea that we might want to bind to an arbitrarily large list of generic parameters, all at once. there are many reasons to want to do this: