Skip to content

Instantly share code, notes, and snippets.

View clickToAdvance.js
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 Oct 15, 2018
RubyConf AU 2019 talk proposal
View 00_title.txt
It’s just makeup! How to care about CSS
@fauxparse
fauxparse / Actions.js
Last active Sep 11, 2018
Permissions HOC
View Actions.js
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;
View spot.json
{"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 Jan 7, 2018
PS Daleks user stylesheet
View daleks.css
@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 Aug 16, 2016
Toy hashmap implementation
View hashmap.rb
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
View gist:445b8dc4df934c54d02b
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=" "
@fauxparse
fauxparse / sortable.coffee
Created Jan 13, 2015
Sortable lists in < 100 LoC
View sortable.coffee
class SortableList
constructor: (el) ->
@el = $(el)
down: (e) =>
e.preventDefault()
top = @el.offset().top
@el.find(".sortable").each (i, el) ->
$el = $(el)
offset = $el.offset().top
View jshint.output.txt
pathological.js: line 1, col 17, Wrap an immediate function invocation in parentheses to assist the reader in understanding that the expression is the result of a function, and not the function itself.
pathological.js: line 1, col 17, Expected an assignment or function call and instead saw an expression.
pathological.js: line 2, col 17, Move the invocation into the parens that contain the function.
@fauxparse
fauxparse / polling.example.js
Created May 3, 2012
Easy polling in jQuery
View polling.example.js
$.poll({
url: '/status.json'
, dataType: 'json'
, timeout: 1000 // initial timeout of 1s
, multiplier: 2 // double the timeout each time
, retries: 10 // maximum of ten tries
, until: function(data) { return data.status == 'done'; }
, success: function(data) { alert(data.message); }
});