Skip to content

Instantly share code, notes, and snippets.

Avatar

Julien Genestoux julien51

View GitHub Profile
View unlock-vue.js
<template>
<div>
<div v-if="unlockState === 'locked'">locked</div>
<div v-if="unlockState === 'pending'">pending</div>
<div v-if="unlockState === 'unlocked'">unlocked</div>
<button @click="checkout()">checkout</button>
</div>
</template>
<script>
View config.js
var unlockProtocolConfig = {
locks: {
'0xabc...': {
name: 'One Week',
},
'0xdef...': {
name: 'One Month',
},
'0xghi...': {
name: 'One Year',
View wordpress.html
<!-- wp:unlock/unlock-box {"unlockState":"unlocked"} -->
<div class="wp-block-unlock-unlock-box unlock-protocol__unlocked">
<!-- wp:paragraph -->
<p>This is content is for members</p>
<!-- /wp:paragraph -->
<!-- wp:latest-posts /-->
</div>
<!-- /wp:unlock/unlock-box -->
<!-- wp:unlock/unlock-box -->
@julien51
julien51 / unlock-js.js
Created Oct 30, 2019
unlock-js wallet example : deploys a lock, purchases a key
View unlock-js.js
const HDWalletProvider = require("truffle-hdwallet-provider")
const { WalletService } = require("@unlock-protocol/unlock-js")
const provider = new HDWalletProvider(
mnemonic,
endpoint,
accountIndex
)
async function run() {
View .unlock-protocol.config.json
{
"persistentCheckout": true,
"icon": "https://assets.unlock-protocol.com/tmp/webtorrent.png",
"callToAction": {
"default": "👋 Hey there, I'm Feross! ✨
\nI'm an open source author, maintainer, and mad scientist. I maintain 100+ packages on npm which are downloaded 100+ million times per month 🤯It's quite mind-blowing, tbh! All my code is freely accessible on GitHub.\nPlease, help me continue my work on WebTorrent by showing your support!",
"pending": "Thank you for your support. It means a lot to me!",
"confirmed": "Thank you for your support. It means a lot to me!"
},
"locks": {
View gist:e32488550eab7055413e177d24fef468
{
"persistentCheckout": true,
"icon": "https://assets.unlock-protocol.com/tmp/webtorrent.png",
"callToAction": {
"default": "👋 Hey there, I'm Feross! ✨
\nI'm an open source author, maintainer, and mad scientist. I maintain 100+ packages on npm which are downloaded 100+ million times per month 🤯It's quite mind-blowing, tbh! All my code is freely accessible on GitHub.\nPlease, help me continue my work on WebTorrent by showing your support!",
"pending": "Thank you for your support. It means a lot to me!",
"confirmed": "Thank you for your support. It means a lot to me!"
},
"locks": {
View entry.xml
<item>
<title>Koala &#124; 13 millones en 12 meses vendiendo colchones</title>
<link>https://jonsanroman.com/blog/koala-13-millones-en-12-meses-vendiendo-colchones/</link>
<comments>https://jonsanroman.com/blog/koala-13-millones-en-12-meses-vendiendo-colchones/#respond</comments>
<pubDate>Fri, 19 Jul 2019 10:00:24 +0000</pubDate>
<dc:creator><![CDATA[Jon San Roman]]></dc:creator>
<category><![CDATA[Casos Reales]]></category>
<guid isPermaLink="false">https://jonsanroman.com/?p=25746</guid>
<description><![CDATA[Si tienes una tienda online toma nota, hay cosas bastante interesantes que usaron para hacer crecer su comercio online.]]></description>
View gist:e3e428245a7fdb5a850b3a058378fcfa
$ docker-compose -f docker-compose.development.yml up --build
Building ganache
Step 1/17 : FROM trufflesuite/ganache-cli:v6.4.3
---> a664cedca87f
Step 2/17 : LABEL Unlock <ops@unlock-protocol.com>
---> Using cache
---> 0329b698ac3f
Step 3/17 : RUN apk add --no-cache git openssh bash
---> Using cache
---> b43d88f5725a
View unlock-snippet.html
// Loading the script
<script>
(function (d, s) {
var js = d.createElement(s),
sc = d.getElementsByTagName(s)[0];
js.src = "https://paywall.unlock-protocol.com/static/unlock.1.0.min.js";
sc.parentNode.insertBefore(js, sc);
}(document, "script"));
</script>
You can’t perform that action at this time.