Skip to content

Instantly share code, notes, and snippets.

View johnoscott's full-sized avatar

Johno Scott johnoscott

View GitHub Profile
@johnoscott
johnoscott / react-data-grids.md
Last active April 18, 2018 03:19
[React Data Grid Examples] Some research on the better data grids for React #datagrid #react

React Data Grid Examples

Edit new

<iframe src="https://codesandbox.io/embed/new" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe> Edit new
<iframe src="data:text/html;charset=utf-8,%3Cbody%3E%3Cscript%20src%3D%22https%3A%2F%2Fgist.github.com%2Fef4%2Ffe2e8e5b6e75266e3c2d.js%22%3E%3C%2Fscript%3E%3C%2Fbody%3E">
@johnoscott
johnoscott / out.log
Created November 12, 2018 23:57
Create a Self-signed Certificate for Development
Credit to : https://github.com/kingkool68/generate-ssl-certs-for-local-development
Here is the sample output after running the script:
sudo ./generate-ssl.sh local.dev
Password:
Generating RSA private key, 2048 bit long modulus
..........+++
..............................................+++
@johnoscott
johnoscott / sparkline.md
Last active November 15, 2018 08:08
Hide Sparkline end value
@johnoscott
johnoscott / sample-excw.excalidraw
Last active July 13, 2020 16:15
Draw.io Diagrams
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [
{
"type": "rectangle",
"version": 192,
"versionNonce": 1899200910,
"isDeleted": false,
## Connect PG8000 to database
conn = pg8000.connect(database=args['db_name'],user=args['db_user'],password=args['db_password'],host=args['db_host'],port=5432)
cur = conn.cursor()
# ...
# Example upsert query
cur.execute("INSERT INTO {} SELECT * FROM {} ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name".format('campaigns', 'tmp_staging_campaings'))
# ...
conn.commit()
cur.close()
conn.close()
@johnoscott
johnoscott / cognito.py
Created December 14, 2020 14:12 — forked from bjinwright/cognito.py
Example of how to make an authorized call to API Gateway using Boto3, Requests, and AWS4Auth. http://stackoverflow.com/questions/37336286/how-do-i-call-an-api-gateway-with-cognito-credentials-in-python
import boto3
import datetime
import json
from requests_aws4auth import AWS4Auth
import requests
boto3.setup_default_session(region_name='us-east-1')
identity = boto3.client('cognito-identity', region_name='us-east-1')
account_id='XXXXXXXXXXXXXXX'
@johnoscott
johnoscott / esm-package.md
Created June 8, 2021 03:23 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@johnoscott
johnoscott / macro.gs
Created July 12, 2021 19:23 — forked from jsjoeio/macro.gs
Google Spreadsheet macro example
/** @OnlyCurrentDoc */
const startDate = new Date("2021-06-16")
// so the first one is D2:K2
function MarkEmptyCellsInYesterdayRowWithHyphen() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Group 2 - B");
// Activates the sheet
SpreadsheetApp.setActiveSheet(sheet);
const today = new Date()
@johnoscott
johnoscott / babel_url_encoding.md
Last active August 2, 2021 22:37
babel url encoding for http get params