A Pen by Tayfun Erbilen on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isu(node, item){ | |
| node.map().once(function (data) { | |
| let aProps = Object.getOwnPropertyNames(data); | |
| let bProps = Object.getOwnPropertyNames(item); | |
| // number of properties | |
| if (aProps.length === bProps.length) { | |
| console.log("same len") | |
| for (let i = 0; i < aProps.length; i++) { | |
| let propName = aProps[i]; | |
| // values of same property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setu(node, item){ | |
| let unique = true | |
| node.map().once(function (data) { | |
| let aProps = Object.getOwnPropertyNames(data); | |
| let bProps = Object.getOwnPropertyNames(item); | |
| // number of properties | |
| if (aProps.length === bProps.length) { | |
| console.log("same len") | |
| for (let i = 0; i < aProps.length; i++) { | |
| let propName = aProps[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setu(node, item){ | |
| let unique = true | |
| node.map().once(function (data) { | |
| let aProps = Object.getOwnPropertyNames(data); | |
| let bProps = Object.getOwnPropertyNames(item); | |
| // number of properties | |
| if ((aProps.length-1) === bProps.length) { | |
| for (let i = 1; i < aProps.length; i++) { | |
| let propName = aProps[i]; | |
| // values of same property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user.recall(6 * 60, { // minutes | |
| session: true, | |
| hook: function(props) { // { iat, exp, remember } | |
| console.log("got to hook") | |
| var passed = (Time.now() / 1000) - props.iat; // seconds internally | |
| return (passed < exp) ? ((props.exp += passed) && props) : props; | |
| } | |
| }).then(function(ack) { | |
| console.log("got to then") | |
| if (ack && ack.sea) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setu(node, item){ | |
| let unique = true | |
| let comparison = function (data) { | |
| let aProps = Object.getOwnPropertyNames(data); | |
| let bProps = Object.getOwnPropertyNames(item); | |
| // number of properties | |
| if ((aProps.length-1) === bProps.length) { | |
| for (let i = 1; i < aProps.length; i++) { | |
| let propName = aProps[i]; | |
| // values of same property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gun.on('auth', function(){ | |
| $('.loggedOut').hide(); | |
| $('.loggedIn').show(); | |
| user.get('said').map().once(UI); | |
| user.get('alias').val(function(name){ | |
| //console.log(name) | |
| if(upPub !== null){ | |
| let peers = gun.get('peers') | |
| peers.once(function(data){ | |
| let uSet = {name: name, pub: upPub} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('#up').on('click', function(e) { | |
| e.preventDefault(); | |
| let aliasIn = $('#alias').val() | |
| let passIn = $('#pass').val() | |
| gun.get("~@" + aliasIn).once(function (uAlias) { | |
| if (uAlias === undefined) { | |
| console.log("alias undefined, registering.") | |
| user.create($('#alias').val(), $('#pass').val(), function (ack) { | |
| console.log("create user ack: " + ack) | |
| user.auth($('#alias').val(), $('#pass').val()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import aiohttp | |
| from aiohttp_socks import ProxyType, ProxyConnector, ChainProxyConnector | |
| async def fetch(url): | |
| connector = ProxyConnector.from_url('socks5://user:password@127.0.0.1:1080') | |
| ### or use ProxyConnector constructor | |
| # connector = ProxyConnector( | |
| # proxy_type=ProxyType.SOCKS5, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def blocking_io(): | |
| print(f"start blocking_io at {time.strftime('%X')}") | |
| # Note that time.sleep() can be replaced with any blocking | |
| # IO-bound operation, such as file operations. | |
| time.sleep(1) | |
| print(f"blocking_io complete at {time.strftime('%X')}") | |
| async def main(): | |
| print(f"started main at {time.strftime('%X')}") |