Skip to content

Instantly share code, notes, and snippets.

View toastal's full-sized avatar
🚪
Offer alt mirror so I can delete my account w/ MS GitHub finally

toastal

🚪
Offer alt mirror so I can delete my account w/ MS GitHub finally
View GitHub Profile
@toastal
toastal / 0-param-lodash-original-to-be-refactored.js
Last active October 18, 2021 08:08
Object to Query String Refactors
// Well the string building is pretty dopey with the `+=` append on
// a forEach instead of a map, but that slice on the last char sends
// shivers of cringe up my spine.
_.mixin({
param: function(obj) {
var param = "";
_.forEach(obj, function(val, key) {
param += key + "=" + val + "&";
});

Debian Laptop Setup

What are we aiming for?

Debian unstable/sid, two SSDs in Btrfs RAID0, GRUB, Nvidia+Bumblebee, Openbox+Other DE stuff, HiDPI, some basic dev needs

Why is this special?
(into [:dl]
(map #(vector %1 %2) (cycle [:dt :dd]) (flatten (vec (clojure.walk/stringify-keys {:test "me" :foo "bar"})))))
;=> [:dl [:dt "test"] [:dd "me"] [:dt "foo"] [:dd "bar"]]
@toastal
toastal / ECMAScript2015-JSX-4-space.js
Last active October 18, 2021 07:59
Readability: DOM Functions v JSX; LiveScript v ECMAScript2015; 2 space v 4 space
// renderDeviceDetailsInfo : Device -> React.Node
const renderDeviceDetailsInfo = function renderDeviceDetailsInfo(device) {
const volCount = availableVolumes.reduce((acc, vol) =>
acc + 1 + (vol.subdirs ? vol.subdirs.length : 0)
, 0);
return (
<div className: "device-details-info">
{
[
@toastal
toastal / gist:01c2387456ad2e6385f4
Last active October 18, 2021 07:54
Open All Links In a New Tab
// Open all links on a page in new tab -- for MBW
// Requires ECMAScript 6's `Set()` for getting unique urls
// I'm too lazy to write a `uniq` function nor do I want to pull in a 3rd party lib
// Works in Firefox 25+, Chrome 38+, Opera 25+, Safari 7.1+, Internet Explorer 11+
new Set(
Array.prototype.filter.call(document.querySelectorAll('a[href],area[href]'), function(acc, el) {
el.href[0] !== '#' && acc.push(el)
return acc
}, [])
).forEach(function(href) {
@toastal
toastal / admonition.adoc
Last active October 8, 2021 04:23
Use Admonitions
Important
Use Admonitions

Admonitions are a better way to do callouts in documentations. Using > in Markdown in a blockquote and should be used for quotes. Markdown has many limitations and is very fragmented in its syntax leading to many competing flavors. AsciiDoc can remedy many of these shortcomings. GitLab and GitHub support AsciiDoc for markup rendering now. It’s a viable option with a few extra handy features you just can’t get with Markdown.

@toastal
toastal / init.vim
Last active June 24, 2020 16:56
Nvim conf
" vim: noai ts=2 sw=2
set shell=/bin/fish
let g:EditorConfig_exec_path = '/bin/editorconfig'
if has('mouse') | set mouse=a | endif
"set relativenumber
set number
set scrolloff=4
set inccommand=split
/* vim: set noai ts=4 sw=4: */
:root {
-moz-tab-size: 4;
tab-size: 4;
}
code, kbd, pre {
font-variant-ligatures: none;
}
@toastal
toastal / Main.elm
Created December 6, 2016 22:46
Elm URL Parsing Playaround
module Main exposing (..)
{-| elm-package install elm-lang/navigation evancz/url-parser
-}
import Html exposing (Html, caption, div, table, tbody, td, text, th, thead, tr)
import Navigation exposing (Location)
import String
import UrlParser exposing (Parser, (</>), map, oneOf, s, int, string, top, parseHash)
@toastal
toastal / RAF.purs
Created April 22, 2019 03:20 — forked from garyb/RAF.purs
requestAnimationFrame looping subscription in Halogen 5
module RAF where
import Prelude
import Data.Foldable (traverse_)
import Data.Maybe (Maybe(..))
import Effect.Aff.Class (class MonadAff)
import Effect.Ref as Ref
import Halogen as H
import Halogen.HTML as HH