Skip to content

Instantly share code, notes, and snippets.

View cesarfigueroa's full-sized avatar

Cesar Figueroa cesarfigueroa

View GitHub Profile

Keybase proof

I hereby claim:

  • I am cesarfigueroa on github.
  • I am cesarfigueroa (https://keybase.io/cesarfigueroa) on keybase.
  • I have a public key ASCUcTWHUmZ18gMbb56IHd8EtFblmoHUGNBR3uJXOXbdLQo

To claim this, I am signing this object:

@cesarfigueroa
cesarfigueroa / flow-component-without-props.js
Created September 23, 2018 19:34
Component Without Props in Flow
// @flow
import * as React from 'react';
type ProplessComponent = React.ComponentType<{||}>
const component: ProplessComponent = () => <p>Hello World</p>
React.createElement(component, Object.freeze({}))
React.createElement(component, Object.freeze({ a: 1 })) // Error!
base64 -d <<< "$(pbpaste)" > file.jpg
const WHITESPACE_PATTERN = /^[ \t]*(?=\S)/gm;
export function stripIndent(strings, ...expressions) {
const resultString = strings.reduce((accumulator, part, i) => {
return accumulator + expressions[i - 1] + part;
});
const indents = Math.min(
...resultString.match(WHITESPACE_PATTERN).map(whitespace => whitespace.length)
);
function moveItem(list, from, to) {
return list.delete(from).insert(to, list.get(from));
}
git push staging $(git rev-parse --abbrev-ref HEAD):master
- Connection pools
- Data schemas
- Validations and errors
- Domain logic
- URL generation and parameter handling
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
@cesarfigueroa
cesarfigueroa / cors.sh
Created January 22, 2016 17:55
Making a CORS request with cURL
curl --verbose --silent --header 'Origin: [TDL_DOMAIN]' [RESOURCE_URL] 1> /dev/null
(400..599).each do |status_code|
error status_code do
send_file "#{settings.public_dir}/#{status_code}.html",
:status => status_code
end
end