Skip to content

Instantly share code, notes, and snippets.

@avjpl
avjpl / README.md
Created August 16, 2021 12:38 — forked from justincy/README.md
Configure Storybook to work with Next.js, TypeScript, and CSS Modules

In addition to the Storybook for React setup, you'll also need to install these packages:

npm i -D @babel/core babel-loader css-loader style-loader
@avjpl
avjpl / LICENSE
Created May 22, 2021 17:40 — forked from curran/LICENSE
Simplemaps: World Cities Database
This license is a legal document designed to protect your rights and the rights of the Pareto Software, LLC, the owner of Simplemaps.com. Please read it carefully. Purchasing or downloading a data product constitutes acceptance of this license.
Description of Product and Parties: This license is a contract between you (hereafter, the Customer) and Pareto Software, LLC (hereafter, the Provider) regarding the use and/or sale of an collection of geographic data (hereafter, the Database).
Ownership of Database: All rights to the Database are owned by the Provider. The Database is a cleaned and curated collection of geographic facts and the Provider retains all rights to the Database afforded by the law. Ownership of any intellectual property generated by the Provider while performing custom modifications to the Database for a Customer (with or without payment) is retained by the Provider.
License: Customers who purchase a license are allowed to use the database for projects that benefit their organization or t
@avjpl
avjpl / Sidebar-test.jsx
Created December 18, 2018 13:12 — forked from stipsan/Sidebar-test.jsx
Testing with Jest: Tip #5
import renderer from 'react-test-renderer'
import Sidebar from '../Sidebar'
jest.mock('react-router-dom', () => ({
Link: 'Link',
Route: ({ children, path }) => children({ match: path === '/somewhere' })
}))
it('should render correctly', () => {
const component = renderer.create(<Sidebar />)
@avjpl
avjpl / postgres-cheatsheet.md
Created October 7, 2018 13:15 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@avjpl
avjpl / app.js
Created July 18, 2017 19:45 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@avjpl
avjpl / destructuring.js
Created May 12, 2017 08:17 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@avjpl
avjpl / install_openresty_in_mac.md
Created April 25, 2017 13:43 — forked from ejlp12/install_openresty_in_mac.md
Install openresty in Mac OS-X

Install 3scale self managed API gateway (openresty) in Mac OS-X

brew update
brew install pcre openssl

wget http://openresty.org/download/ngx_openresty-1.9.7.2.tar.gz
tar xzvf ngx_openresty-1.9.7.2.tar.gz
cd ngx_openresty-1.9.7.2
@avjpl
avjpl / sandbox-mocha.js
Created April 13, 2017 17:08 — forked from jgable/sandbox-mocha.js
Sinon Sandbox Example
var sinon = require('sinon'),
Widget = require('../../widget');
describe('My widget', function () {
var sandbox;
beforeEach(function () {
// Create a sandbox for the test
sandbox = sinon.sandbox.create();
});
@avjpl
avjpl / app.js
Created December 14, 2016 10:39 — forked from ezekielchentnik/app.js
import express from 'express';
const app = express();
if (IS_DEV) {
require('piping')();
}
//express routes, etc.
export default app;
@avjpl
avjpl / links.md
Created November 21, 2016 20:35 — forked from g0t4/links.md
Starting Point Files for Jenkins2 Getting Started course