Skip to content

Instantly share code, notes, and snippets.

@nagisa
nagisa / Cargo.toml
Last active February 11, 2020 17:31
[workspace]
members = [
"brand_new",
"old_rusty",
]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# seqcst store/load:
data memory barrier
store/load
data memory barrier
# acquire load:
data memory barrier
  • Feature Name: type_name
  • Start Date: 2018-04-21
  • RFC PR: (leave this empty)
  • Rust Issue: (leave this empty)

Summary

Make the output of type_name structured and convenient and put the intrinsic on the path to sabilisation.

#![feature(unicode, core_intrinsics)]
struct MyString(String);
impl From<Vec<char>> for MyString {
fn from(mut chars: Vec<char>) -> MyString {
let mut bytes_used = 0usize;
let length = chars.len();
for index in 0..length {
let current_char = unsafe { *chars.get_unchecked(index) };
let output_buf: &mut [u8] = unsafe {
# Getting the git version of pacaur
amebox :: ~/d/test
𝛌pacaur -S pacaur-git
:: Package(s) pacaur-git not found in repositories, trying AUR...
:: resolving dependencies...
:: looking for inter-conflicts...
:: pacaur-git and pacaur are in conflict. Remove pacaur? [y/N] y
AUR Packages (1): pacaur-git-latest
(22:22:13) bz: simukis_: max-content can't depend on content height
(22:22:25) bz: simukis_: so can't depend on whether there is a vertical scrollbar
(22:22:57) bz: simukis_: there is no way to win there: either you get a gap or a horizontal scrollbar. :(
(22:23:30) bz: simukis_: I _think_ for overflow-y:scroll we include the vertical scrollbar width and for overflow-y:auto we do not or something like that
(22:24:15) simukis_: bz: but then scrollbar would be visible on short content as well which is undesirable in many cases.
(22:25:00) simukis_: I suspect a lot of people will complain about that in the future.
(22:25:30) bz: simukis_: there's just no sane way to make this work
(22:26:29) bz: simukis_: "people" have contradictory requirements
(22:26:37) bz: simukis_: So life is bad for someone sometime.
@nagisa
nagisa / gist:5019206
Last active December 14, 2015 03:09
For people who want to sort items in hakyll by time in metadata
sortOnM :: (Monad m, Ord k) => (a -> m k) -> [a] -> m [a]
sortOnM f xs = liftM (map fst . sortBy (comparing snd)) $
mapM (\x -> liftM (x,) (f x)) xs
chronologicalMeta :: [Item a] -> Compiler [Item a]
chronologicalMeta = sortOnM $ getItemUTC defaultTimeLocale . itemIdentifier
recentFirstMeta :: [Item a] -> Compiler [Item a]
recentFirstMeta i = return . reverse =<< chronologicalMeta i
Mažesnis feature barjeras.
Pavyzdžiui į aštuonioliktą versiją įkišo naują JS engine ir netoli matosi Australis tema.
Jei būtų versijuojama ankstesniu principu, Mozilla release team'as būtų ko gero liepȩs
laukti kol abu fyčersai bus paruošti kad būtų galima viską išleisti vienu major releasu.
O dabar fyčersai ateina kada jie būna paruošti ± 2 mėn.
@nagisa
nagisa / gist:4972837
Last active December 13, 2015 20:48
Hyphenation of words in hakyll
import Text.Hyphenation (hyphenate, english_GB)
import Text.Pandoc (bottomUp, Pandoc)
import Text.Pandoc.Definition
------------------------------------------------------------
hyphenatePandoc :: Pandoc -> Pandoc
hyphenatePandoc = bottomUp (hyphInline :: Inline -> Inline)
where hyphW = intercalate "\x00AD" . hyphenate english_GB
hyphWs = unwords . map hyphW . words
hyphInline (Str str) = Str $ hyphWs str
hyphInline a = a