Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan De La Torre rgdelato

  • ServiceTitan
  • Los Angeles, CA, USA
  • @rgdelato
View GitHub Profile
View rich-already-answered-that.md

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.

Why no pattern matching?

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

View uncontrolled-react-forms.md

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 Apr 28, 2017 — forked from 1Marc/workshops-planning.md
Workshop Teachers Needed
View teachers-needed.md

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 Jan 16, 2017
Styled Components
View App.js
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};
View three-ways-same-UI.js
// component state
class LedgerContainer extends React.Component {
state = {
debits: null,
credits: null,
creditsError: null,
debitsError: null
}
componentDidMount() {
@rgdelato
rgdelato / slack_delete.js
Created Oct 27, 2016
Node script to delete all Slack files older than 30 days
View slack_delete.js
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 Apr 9, 2018
ES5 Array methods as applied to Object.prototype (map and filter are currently incorrect implementations)
View object.prototype-array-methods.js
// 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;