Skip to content

Instantly share code, notes, and snippets.

View xunorus's full-sized avatar

Xunorus xunorus

View GitHub Profile
@xunorus
xunorus / contracts...opptonev1.sol
Created April 27, 2022 07:40
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// simpler NFT contract for OPPT-ONE with:
// - burning
// - pausable
// - roles
// - emits universalPass event
// - any address can mint but just one NFT per address
import "@openzeppelin/[email protected]/token/ERC721/ERC721.sol";
@xunorus
xunorus / vanilla-ajax-poll.js
Created March 22, 2022 01:14 — forked from twmbx/vanilla-ajax-poll.js
Polling in JS with an async ajax call that returns a promise ( modified from: https://davidwalsh.name/javascript-polling )
// The polling function
function poll(fn, timeout, interval) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
var checkCondition = function(resolve, reject) {
var ajax = fn();
// dive into the ajax promise
ajax.then( function(response){
// If the condition is met, we're done!
@xunorus
xunorus / convert.js
Created August 23, 2018 03:26 — forked from miracle2k/convert.js
Convert Ethereum private keys to EOS private keys (the "Fallback method" to access your EOS tokens).
// Extracted from https://github.com/eoscafe/eoskeyio
const ecc = require('eosjs-ecc');
const eth = require('ethereumjs-util');
let ethereumPrivateKey = 'FILL THIS IN';
if(eth.isValidPrivate(Buffer.from(ethereumPrivateKey, 'hex'))) {
let ethereumAddress = '0x' + eth.privateToAddress(Buffer.from(ethereumPrivateKey, 'hex')).toString('hex')
let ethereumPublicKey = eth.privateToPublic(Buffer.from(ethereumPrivateKey, 'hex')).toString('hex')
image: node:latest
cache:
paths:
- node_modules/
- app/bower_components
deploy_production:
stage: deploy
environment: Production
@xunorus
xunorus / buzz-player.js
Created April 28, 2016 01:38 — forked from vvasilev-/buzz-player.js
mini audio player with Buzz.js
// constructor
var Player = function(source){
// cache vars
this.sound = new buzz.sound(source.split('.')[0], { formats: ['ogg', 'mp3'], volume: 100 });
this.$playBtn = $('.ui-page-active .jp-play');
this.$pauseBtn = $('.ui-page-active .jp-pause');
this.$rewindBtn = $('.ui-page-active .rewind');
this.$duration = $('.ui-page-active .jp-duration');
this.$seekBar = $('.ui-page-active .jp-seek-bar');
{% for post in site.posts %}
<article class="{% if forloop.first %}first{% elsif forloop.last %}last{% else %}middle{% endif %}">
<div class="article-head">
<h2 class="title"><a href="/{{ post.url }}/" class="js-pjax">{{ post.title }}</a></h2>
<p class="date">{{ post.date | date: "%b %d, %Y" }}</p>
</div><!--/.article-head-->
<div class="article-content">
{{ post.long_description }}
<a href="/{{ post.url }}/" class="full-post-link js-pjax">Read more</a>
</div><!--/.article-content-->