Skip to content

Instantly share code, notes, and snippets.

View sajclarke's full-sized avatar

Shannon Clarke sajclarke

View GitHub Profile
@klawingco
klawingco / useFacebook.js
Created January 22, 2021 01:51
useFacebook - a hook for Loading FB Login SDK for React
import { useState, useEffect, useCallback } from 'react';
const initializeFb = () =>
// eslint-disable-next-line no-unused-vars
new Promise((resolve, _reject) => {
if (typeof FB !== 'undefined') {
resolve();
} else {
// eslint-disable-next-line func-names
window.fbAsyncInit = function() {
$(".new-goods-submit-button").on('click',function(){
console.log('submitting goood');
//get hash of the good
var file_unique_hash = $("#good_file_input").data('uniquehash');
var file_name = "canoe";
var file_description = "a wooden boat";
@madcoda
madcoda / App.js
Created May 28, 2017 04:24
React-router v4 multi layout
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Link, Match, Redirect, Switch } from 'react-router-dom'
import OverviewPage from './page/OverviewPage'
import AccountPage from './page/AccountPage'
/*
Layouts, inline define here for demo purpose
you may want to define in another file instead
*/
@siakaramalegos
siakaramalegos / basic_router.jsx
Last active July 6, 2023 04:02
Basic example of React Router: BrowserRouter, Link, Route, and Switch
// BrowserRouter is the router implementation for HTML5 browsers (vs Native).
// Link is your replacement for anchor tags.
// Route is the conditionally shown component based on matching a path to a URL.
// Switch returns only the first matching route rather than all matching routes.
import {
BrowserRouter as Router,
Link,
Route,
Switch,
} from 'react-router-dom';
.PHONY: run
# certs and output
OUTPUT_FILE=apkname.apk
ALIAS=youralias
KEYPASS=yourkeypass
KEYSTORE=certs/yourcert.keystore
UNSIGNED=platforms/android/build/outputs/apk/android-release-unsigned.apk
# or, if you're using Crosswalk:
@jasonals
jasonals / bus-routes.json
Created October 25, 2015 18:48
Barbados's public transportation
[
{
"busId": "1",
"routeId": "",
"name": "Princess Alice Terminal to Speightstown Terminal",
"num": "1",
"stops": []
},
{
"busId": "2",
// This is a dead-simple script that simply logs the usernames of the people who have updated a post, ordered by when they voted
var access_token = "YOUR_TOKEN";
var post_id = "POST_ID";
var theUrl = "https://api.producthunt.com/v1/posts/"+post_id+"/votes?access_token=" + access_token
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false );
xmlHttp.send( null );
votes = JSON.parse(xmlHttp.responseText).votes;
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@sean-hill
sean-hill / Ionic and ngCordova upload example
Last active May 6, 2019 01:52
Upload service for Ionic and ngCordova
Ionic and ngCordova upload example
@shime
shime / _readme.md
Last active April 28, 2023 18:56
github oauth in node using express

What?

Most basic example of authenticating with Github in node.

How?

Clone this gist, change keys inside config.js and then hit npm install && node app.js.

Done?