Skip to content

Instantly share code, notes, and snippets.

View spurton's full-sized avatar

Scott Burton spurton

View GitHub Profile
@spurton
spurton / proxyObserver.js
Created November 15, 2018 00:44
Well rounded Proxy observer
const renderManObserver = function renderManObserver(value) {
console.log('Re-rendering...', `<blink>${value}</blink>`)
}
let state = {
name: '',
thisOtherThing: {
name: '',
deeper: {
name: '',
var renderManObserver = function renderManObserver(value) {
console.log('Re-rendering...', `<blink>${ value }</blink>`);
};
var o = {
name: ''
};
var makeReactive = function makeReactive(obj, observer) {
Object.keys(obj).map(function (value) {
@spurton
spurton / MiddleMenu.js
Created March 21, 2018 18:31
Middle Menu Component using Recompose
import React from 'react';
import PropTypes from 'prop-types';
import AutoAffix from 'react-overlays/lib/AutoAffix';
import { withState } from 'recompose';
import { fonts, colors } from '../../components/common/theme';
const enhance = withState('selected', 'setSelected', null);
const MiddleMenu = enhance(({ menuItems, selected, setSelected }) => {
const renderMenuItems = () => {
@spurton
spurton / VimeoThumbnail.js
Last active March 30, 2018 17:25
Vimeo Thumbnail Component
import React, { Component } from 'react';
import PropTypes from 'prop-types';
class VimeoThumbnail extends Component {
state = {
loading: true,
thumbnail: null
};
componentDidMount() {
@spurton
spurton / gist:9d74ceb630671ee846402ce99f94a5b5
Created April 27, 2017 18:14
GitIgnore for React Native
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
@spurton
spurton / gist:5760638
Created June 11, 2013 21:00
Strong parameters fix
require 'rocket_pants/errors'
module RocketPants
class Base < ActionController::Metal
abstract!
MODULES = [
ActionController::HideActions,
We couldn’t find that file to show.
Net::HTTP.start(@uri.host, @uri.port) do |http|
request = Net::HTTP::Post.new(@uri.to_s, {'Content-type => 'whatever'})
request.basic_auth(@uri.user, @uri.password) if @uri.user && @uri.password
result = http.request(request, data)
end