Skip to content

Instantly share code, notes, and snippets.

View rainforest-of-code's full-sized avatar

rainforest-of-code

View GitHub Profile
@rainforest-of-code
rainforest-of-code / SCSS.md
Created July 24, 2017 10:29 — forked from jareware/SCSS.md
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

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@rainforest-of-code
rainforest-of-code / linux.sh
Created January 10, 2017 08:24 — forked from marcan/linux.sh
Linux kernel initialization, translated to bash
#!/boot/bzImage
# Linux kernel userspace initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <[email protected]>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name
@rainforest-of-code
rainforest-of-code / redux-distilled.md
Created July 15, 2016 20:43 — forked from deanrad/redux-distilled.md
TL;DR Better Redux involves using maps of action types to reducers, not switch/case statements

Distilling the Essence of Reducers

Redux has brought the notion of reducer back into the awareness of many developers for whom they are a novel concept. In fact they are quite simple, and used all the time in such things as SUM aggregations in databases, where they compute a single value from many.

It's great that Redux has made reducers known to a broader audience, though they are relatively ancient concepts in programming, in fact. But the particular way Redux illustrates a reducer in its documentaion is, in my opinion, with a coding style that is harder to extend and read than it should be. Let's distill reducers down to their essensce, and build up Redux reducers in a way that lowers complexity, and helps separate Redux idioms from your business logic.

The simplest reducer

A reducer is a pure function that accepts more arguments than it returns. That is to say - one whose "arity" is greater than 1. It 'reduces' the two things you pass it down to a single value. Here are two reducers, in a map

{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Oceanic Next Color Scheme/Oceanic Next.tmTheme",
"draw_white_space": "all",
"font_face": "Fira Mono",
"font_size": 20,
"tab_size": 2,
"theme": "Brogrammer.sublime-theme",
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
{
"total": 960,
"pages": [
{
"page": 1,
"videos": [
{
"name": "SOCIAL ENGINEERING FOR/WITH/USING KANBAN",
"href": "https://vimeo.com/153349770",
"duration": "51:40",
@rainforest-of-code
rainforest-of-code / ssh-tunnel-proxy-digitalocean.md
Created December 29, 2015 08:32 — forked from nathanleclaire/ssh-tunnel-proxy-digitalocean.md
A description of how to get started using SSH tunneling. Intended for subverting network shaping and other nasty things imposed on you by arbitrary networks.

This is a method to create a proxy which is pretty simple and does not involve using shady websites or proprietary applications, etc.

  1. First, create a server, such as a DigitalOcean droplet.

  2. Once the server is created, verify that you can login via SSH:

    $ ssh user@<ip>
    
  3. If that is working, creating a local [SOCKS5] proxy using OpenSSH is just one command. Here is one suggestion:

@rainforest-of-code
rainforest-of-code / springer-free-maths-books.md
Created December 29, 2015 07:16 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
@rainforest-of-code
rainforest-of-code / [1] convert_to_html.js
Created September 25, 2015 19:07 — forked from nathansmith/[1] convertToMarkup.js
Handy utilities for dealing with `<div contenteditable="true">` areas.
/*
You would call this when receiving a plain text
value back from an API, and before inserting the
text into the `contenteditable` area on a page.
*/
define(function(require) {
'use strict';
/*
Used to convert text with line breaks
@rainforest-of-code
rainforest-of-code / what-forces-layout.md
Last active September 19, 2015 07:14 — forked from paulirish/what-forces-layout.md
What forces layout/reflow in Chrome. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()