Skip to content

Instantly share code, notes, and snippets.

View MagRelo's full-sized avatar

Matt Lovan MagRelo

View GitHub Profile
@MagRelo
MagRelo / social cards
Created October 22, 2018 17:13
a list of values to dynamically put into the HEAD section of your webpages to enable rich embeds on twitter, facebook, etc.
<!-- openGraph -->
<meta property="fb:app_id" content="381364391963677"/>
<meta property="og:site_name" content="Spoon University"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="https://spoonuniversity.com/lifestyle/i-went-pescatarian-for-a-month-and-it-wasn-t-that-hard"/>
<meta property="og:title" content="I Went Pescatarian For a Month And It Wasn&#x27;t That Hard"/>
<meta property="og:description" content="A month with no meat can seem like a terrifying restriction, but once put into practice, you may discover that it is an opportunity to be exposed to new flavors, techniques and styles of food!"/>
<meta property="og:image" content="https://s3.amazonaws.com/secretsaucefiles/photos/images/000/147/466/large/poke_bowl_by_nancy_goa.jpg?1489081470"/>
<meta property="og:image:secure_url" content="https://s3.amazonaws.com/secretsaucefiles/photos/images/000/147/466/large/poke_bowl_by_nancy_goa.jpg?1489081470"/>
@MagRelo
MagRelo / gist:a037d987579867bbfa14b3aabc282142
Created June 22, 2018 16:59
server error using 'shrugs/gnarly-test:demo' image
gnarly-5f7885c68-5686g — TypeError: Cannot read property 'owner' of undefined
gnarly-5f7885c68-5686g — at Object.replace (/snapshot/gnarly/node_modules/@xlnt/fast-json-patch/lib/core.js:27:26)
gnarly-5f7885c68-5686g — at applyOperation (/snapshot/gnarly/node_modules/@xlnt/fast-json-patch/lib/core.js:231:60)
gnarly-5f7885c68-5686g — at Object.applyPatch (/snapshot/gnarly/node_modules/@xlnt/fast-json-patch/lib/core.js:268:22)
gnarly-5f7885c68-5686g — at __dirname.resumeFromTxId.txBatch.forEach (/snapshot/gnarly/node_modules/@xlnt/gnarly-core/lib/Ourbit.js:134:43)
gnarly-5f7885c68-5686g — at Array.forEach (<anonymous>)
gnarly-5f7885c68-5686g — at Ourbit.<anonymous> (/snapshot/gnarly/node_modules/@xlnt/gnarly-core/lib/Ourbit.js:130:29)
gnarly-5f7885c68-5686g — at Generator.next (<anonymous>)
gnarly-5f7885c68-5686g — at fulfilled (/snapshot/gnarly/node_modules/@xlnt/gnarly-core/lib/Ourbit.js:4:58)
gnarly-5f7885c68-5686g — at <anonymous> 'TypeError: Cannot read property \'owner\' of undefined\n at Object.replace (/
const sigUtil = require('eth-sig-util')
app.post('/api/message', (req, res) => {
const messageData = req.body.messageData
const signature = req.body.signature
// recover the public key
const publicKey = sigUtil.recoverTypedSignature({
data: messageData,
@MagRelo
MagRelo / client_side.js
Last active April 8, 2018 22:13
Sign a message using Web3 and send it to the server
import Web3 from 'web3'
// Setup a message with instructions for the server.
const messageData = [
{
name: ‘Contents’,
type: ‘string’,
value: 'extra! extra! read all about it!'
}
]
@MagRelo
MagRelo / index.js
Last active July 3, 2024 11:38
local websocket connection to ganache-cli
const Web3 = require('web3')
// *WRONG*
// const localProviderUrl = 'wss://localhost:8545'
// Result:
//
// connection not open on send()
// Error in subscription wss://localhost:8545
// Error: connection not open
@MagRelo
MagRelo / component_snippet.jsx
Last active December 5, 2017 20:11
Load ethereum contract data into react state using web3
import React, { Component } from 'react'
import { Link } from 'react-router'
// JSON file that describe's the contract's metadata. Created during the contract 'compile' step.
import ExampleContract from '../../../build/contracts/example.json'
class FormComponent extends Component {
constructor(props) {
super(props)
@MagRelo
MagRelo / Servesa_ABI.json
Created November 30, 2017 20:35
ABI for contract at 0x40f8Da2C9B078F6693D80BaC02182268E8B1779a
[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"funders","outputs":[{"name":"exists","type":"bool"},{"name":"tokenCount","type":"uint256"},{"name":"totalPurchasePrice","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenBasePrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"contractStartTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"isFunderTokens","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"spend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"isFunder","outputs":[{"name":"","ty
0x7036B2Fc481951000a616B0447D07a454b6fb5E6
Verifying that "mattlovan.id" is my Blockstack ID. https://onename.com/mattlovan
{
"videoId" : "999",
"title" : "Radical Skateboard Video",
"needsUpdate" : false,
"inError" : false,
"active" : true,
"recordModified" : "2017-07-13T14:22:03.193Z",
"video" : {
"video_name" : "Radical Skateboard Video",
"video_id" : 999,