Skip to content

Instantly share code, notes, and snippets.

View joe-oli's full-sized avatar
💭
what the flock? no status to report, i am not a facebook junkie.

joe-oli

💭
what the flock? no status to report, i am not a facebook junkie.
View GitHub Profile
@joe-oli
joe-oli / links-codepen.txt
Last active December 4, 2019 10:39
links codepen
import { useReducer, useCallback } from 'react';
// Usage
function App() {
const { state, set, undo, redo, clear, canUndo, canRedo } = useHistory({});
return (
<div className="container">
<div className="controls">
<div className="title">👩‍🎨 Click squares to draw</div>
import { Bearer } from 'permit'
import express from 'express'
const permit = new Bearer({
basic: 'username', // Also allow a Basic Auth username as a token.
query: 'access_token', // Also allow an `?access_token=` query parameter.
})
function authenticate(req, res, next) {
// Try to find the bearer token in the request.
@joe-oli
joe-oli / Facebook-social-login.js
Created December 18, 2019 06:42
Facebook social login authentication events etc...
/* FACEBOOK EVENTS BEST PRACTICES
===========================
1. For most cases, you will want to subscribe to auth.authResponseChange rather than auth.statusChange.
The response is returned as a javascript array, not encoded as JSON.
2. Note that for some cases, the value of response is unkeyed, but when more than one variable is returned, it contains the appropriate keys.
3. You can subscribe multiple callbacks to one event using different function names.
=========================== */
@joe-oli
joe-oli / x509-cert-openSSL.txt
Last active December 19, 2019 01:12
notes on creating a self-signed SSL Digital Cert x509
Creating a Self-Signed Certificate
Like enabling HTTPS on a production site, you first need a certificate. For a production site, you request one from a certificate authority like Let’s Encrypt, Comodo, etc. For a local dev environment, we can generate a self-signed certificate on the command line. It used to be as simple as this command:
openssl req -new -sha256 -newkey rsa:2048 -nodes \
-keyout dev.deliciousbrains.com.key -x509 -days 365 \
-out dev.deliciousbrains.com.crt
Running that command, you get asked a few questions:
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
@joe-oli
joe-oli / tryout-fb-javascript-sdk.js
Created December 19, 2019 03:48
testing facebook sdk.js - javascript SDK and login / authentication
<body>
<script>
window.fbAsyncInit = function () {
FB.init({
appId: 'MY_APP_ID',
autoLogAppEvents: true,
xfbml: true,
version: 'v5.0'
});
@joe-oli
joe-oli / stars-animation-on-canvas.js
Last active December 24, 2019 00:52
stars animation on canvas example
//https://gist.github.com/huljas/1290219#file-animation-part-1-js
var ctx;
var canvasObj;
var fps = 30;
var stars = [];
var starCount = 30;
var Animation = {
init : function(id) {
@joe-oli
joe-oli / facebook-login-sdk-js.html
Created December 24, 2019 06:42
facebook login api sdk js
<!DOCTYPE html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
</head>
<body>
<a href="#" onClick="postToFacebook()">Post to Facebook</a>
<script>
function postToFacebook() {
@joe-oli
joe-oli / favicon.html
Last active December 27, 2019 17:35
favicon favourite icon fave icon no more annoying favicon could not be loaded message.
<!--
No more annoying messages in console, and no need to add another file to the repository; just include it in the head for a "blank" icon.
-->
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon" />
<!-- ALT: apparently either of the following also suppresses Browser request for favicon.ico -->
<link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;,">
@joe-oli
joe-oli / open-url-in-browser.txt
Created January 1, 2020 14:03
open urls in browser
https://github.com/sindresorhus/open/issues/89
Simple example. the array contains 3 urls;
It iterates thru, logs the urls correctly but only the first url is opened.
urlsArray.forEach(function(urlLine){
opn(urlLine); //for each url... launch in Browser
console.log(urlLine);
});
My environment is Windows / default Browser chrome