Skip to content

Instantly share code, notes, and snippets.

View rgdelato's full-sized avatar

Ryan De La Torre rgdelato

  • ServiceTitan
  • Los Angeles, CA, USA
  • X @rgdelato
View GitHub Profile

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats. The link points back at them.

If you are talking about the aspect of pattern matching that acts as a conditional based upon structure, I'm not a big fan. I feel about them the way I do about switch statements - they're brittle and

@rgdelato
rgdelato / uncontrolled-react-forms.md
Last active May 8, 2017 23:29
Forms in React.js

Forms in React.js

Controlled Change

Lets say you want to make form input that shows the user an error message if they leave it blank. If you typically write controlled inputs, you might do something like this simplified example:

class ControlledInput extends Component {
  state = { fields: { username: "" }, errors: {} };
@rgdelato
rgdelato / teachers-needed.md
Created April 28, 2017 20:41 — forked from 1Marc/workshops-planning.md
Workshop Teachers Needed

Looking for workshop teachers to teach on the following topics!

For introductions please tweet @frontendmasters, @1marc or email: marc at FrontendMasters.com. Thanks!

You can propose other topics too.

Published blog post detailing topics and allowed people to vote on priority: 2016 Frontend Masters topic poll

Bolded topics are very highly requested.

@rgdelato
rgdelato / App.js
Last active January 16, 2017 22:59
Styled Components
import React, { Component } from 'react';
import logo from './logo.svg';
import styled, { keyframes } from 'styled-components';
const AppContainer = styled('div')`
text-align: center;
.app-header {
background-color: ${props => props.color};
// component state
class LedgerContainer extends React.Component {
state = {
debits: null,
credits: null,
creditsError: null,
debitsError: null
}
componentDidMount() {
@rgdelato
rgdelato / slack_delete.js
Created October 27, 2016 17:20
Node script to delete all Slack files older than 30 days
const https = require('https');
const token = '<get an API token here: https://api.slack.com/docs/oauth-test-tokens>';
const ts_to = Math.floor(Date.now() / 1000) - (30 * 24 * 60 * 60);
console.log(`Making API call to: https://slack.com/api/files.list?token=${token}&ts_to=${ts_to}&count=1000`);
https.get(`https://slack.com/api/files.list?token=${token}&ts_to=${ts_to}&count=1000`, (res) => {
let file_data = '';
@rgdelato
rgdelato / object.prototype-array-methods.js
Last active April 9, 2018 14:15
ES5 Array methods as applied to Object.prototype (map and filter are currently incorrect implementations)
// ES5 Array methods
// New methods added: Array.isArray, indexOf, lastIndexOf, every, some,
// forEach, map, filter, reduce, reduceRight
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
// Array.prototype.reduce(function (previousValue, currentValue, currentIndex, array), initialValue)
if (!Object.prototype.reduce) {
Object.prototype.reduce = function (callback, initialValue) {
var _this = this;