Skip to content

Instantly share code, notes, and snippets.

View fauxparse's full-sized avatar

Matt Powell fauxparse

View GitHub Profile
require 'active_support/core_ext/range/overlaps'
class RangeSet
include Enumerable
def initialize(ranges = [])
@ranges = Set.new(self.class.merge_all(ranges.to_a))
end
def <<(range)
{"name":"exported","settings":"{\"settings\":\"{\\n \\\"[css]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"sibiraj-s.vscode-scss-formatter\\\"\\n },\\n \\\"[html]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"vscode.html-language-features\\\"\\n },\\n \\\"[javascript]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },\\n \\\"[javascriptreact]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },\\n \\\"[json]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },\\n \\\"[jsonc]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },\\n \\\"[postcss]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"stylelint.vscode-stylelint\\\"\\n },\\n \\\"[scss]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"sibiraj-s.vscode-scss-formatter\\\"\\n },\\n \\\"[typescript]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },\\n \\\"[typescriptreact]\\\"
@fauxparse
fauxparse / childContext.ts
Last active January 17, 2023 20:36
XState child state context
const Machine = createMachine({
context: {
name: '',
},
schema: {
context: {} as { name: string },
},
states: {
A: {
on: {
@fauxparse
fauxparse / clickToAdvance.js
Last active January 17, 2020 03:05
RxJS fiddles
const { of, fromEvent } = Rx;
const { expand, map, zip } = RxOperators;
const click$ = fromEvent(document, 'click')
of(1).pipe(
expand(x => (
of(x + 1)
.pipe(
zip(click$),
@fauxparse
fauxparse / 00_title.txt
Last active October 15, 2018 01:22
RubyConf AU 2019 talk proposal
It’s just makeup! How to care about CSS
@fauxparse
fauxparse / Actions.js
Last active September 11, 2018 23:54
Permissions HOC
import React, { Component } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import withPermissions from './withPermissions';
import Permissions from './Permissions';
class Actions extends Component {
render() {
const { user: { name, id }, permissions } = this.props;
{"kind":"mobile_provider_price","customer_state":"prospect","needle":{"position":5,"commentary":"Prices are up a little - nothing to worry about though.","price":"8.186","status":"urn:flick:market:price:forecast","unit_code":"cents","per":"kwh","start_at":"2018-05-24T21:30:00.000+00:00","end_at":"2018-05-24T21:59:59.000+00:00","type":"indicative"}}
@fauxparse
fauxparse / daleks.css
Created January 7, 2018 20:54
PS Daleks user stylesheet
@import url('https://fonts.googleapis.com/css?family=Rubik:300,400,700,900');
body,
button {
font-family: 'Rubik', sans-serif !important;
text-rendering: optimizeLegibility;
}
body {
font-weight: 300;
@fauxparse
fauxparse / hashmap.rb
Created August 16, 2016 02:00
Toy hashmap implementation
require 'singleton'
class HashMap
DEFAULT_SIZE = 256
DEFAULT_LOAD = 0.75
def initialize(size: DEFAULT_SIZE, load: DEFAULT_LOAD)
@size = size
@load = load
@count = 0
@fauxparse
fauxparse / gist:445b8dc4df934c54d02b
Created July 20, 2015 06:47
fauxparse.zsh-theme
PROMPT='%{$fg_bold[yellow]%}★%{$fg_bold[green]%}%p %{$fg[blue]%}%c % %{$reset_color%}'
RPROMPT='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=" "