Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Carter Cole neopunisher

🎯
Focusing
View GitHub Profile
View payment.js
var EventSource = require("eventsource");
var es = new EventSource(
"https://horizon-testnet.stellar.org/accounts/GB7JFK56QXQ4DVJRNPDBXABNG3IVKIXWWJJRJICHRU22Z5R5PI65GAK3/payments",
);
es.onmessage = function (message) {
var result = message.data ? JSON.parse(message.data) : message;
console.log("New payment:");
console.log(result);
};
es.onerror = function (error) {
@neopunisher
neopunisher / ans_stellar_quest_nft.js
Last active May 22, 2021
Stellar quest nft solution
View ans_stellar_quest_nft.js
var data = require('./data.json'); #transaction with operations downloaded saved as json
var ops = data._embedded.records.map((r)=>[r.name, new Buffer.from(r.value, 'base64')])
var StellarSdk = require("stellar-sdk");
var server = new StellarSdk.Server("https://horizon-testnet.stellar.org");
var key = StellarSdk.Keypair.fromSecret(
#secret key here
);
View learn.graphql
{
__type(name: "Node") {
name
kind
fields {
name
type {
kind
ofType {
name
View keybase.md

Keybase proof

I hereby claim:

  • I am neopunisher on github.
  • I am cartercole (https://keybase.io/cartercole) on keybase.
  • I have a public key ASCPIeW-of9tc6dFejusNKs7pFm2B-vR_G-fmCmSZVMPfQo

To claim this, I am signing this object:

View gist:973e1274586ec53805e03e19d1e700c9
93126901297815151078288992669518296329218393850654840958127279229911535598978898481635657822531972453651883340618864736759734542679037288413645544246236468657813005590075680252114746033092465493223366471048615346938198314256353419369541307392862912693187785033844054069740144373254706726814612710750178624771990754917602298093521436484064007164284387402867130625133132836281563051896500940516375440328178636152123679634003876766266442445314985666400256314065685651584153149055968640618546932146414
https://tuppers-formula.tk/
View toggleFullscreen.js
function toggleFullScreen() {
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
@neopunisher
neopunisher / webTorrent.js
Last active Aug 29, 2018
Inject default webtorrent
View webTorrent.js
(function(url, inj) { // https://webtorrent.io/docs
inj(url).then(function() {
var client = new WebTorrent()
client.on('torrent', function (torrent) {
console.log('clientorrent:', torrent)
})
View iceGetIp.js
var findIP = new Promise(r=>{var w=window,a=new (w.RTCPeerConnection||w.mozRTCPeerConnection||w.webkitRTCPeerConnection)({iceServers:[]}),b=()=>{};a.createDataChannel("");a.createOffer(c=>a.setLocalDescription(c,b,b),b);a.onicecandidate=c=>{try{c.candidate.candidate.match(/([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g).forEach(r)}catch(e){}}})
/*Usage example*/
findIP.then(ip => document.write('your ip: ', ip)).catch(e => console.error(e))
@neopunisher
neopunisher / deepSearch.js
Last active Jun 8, 2018
recursive search the window like deep(window, 3500, 'window')
View deepSearch.js
function deep(o, q, p = '.', d = 0, s = new Set()) {
try {
if (d > 5 || s.has(o)) {
console.log('depth met or seen', s.has(o), d)
} else if (Array.isArray(o)) {
s.add(o)
return [].concat(...o.map((a, b) => deep.apply(this, [a, q, p + ['[', ']'].join(b), d + 1, s])))
} else if (o instanceof Object) {
s.add(o)
@neopunisher
neopunisher / combinators.js
Created Jun 7, 2018 — forked from Avaq/combinators.js
Common combinators in JavaScript
View combinators.js
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));