Skip to content

Instantly share code, notes, and snippets.

@lexfrl
lexfrl / keybase.md
Last active September 26, 2023 18:49

Keybase proof

I hereby claim:

  • I am lexfro on github.
  • I am fckt (https://keybase.io/fckt) on keybase.
  • I have a public key ASAAS5oUGRYOkXAc0ENjt-p5FIvMyhpwp0kcWje8W_WsLQo

To claim this, I am signing this object:

Aleksei Frolov

https://github.com/lexfro

Experience

Independent Web3 Developer (Aug 2019 - Present)

  • Designed and developed innovative applications using Rust and JavaScript
  • Contributed to open-source projects, collaborating with developers around the world to improve and expand upon existing codebases
  • Active member of the WebAssembly community, helping to moderate the biggest Russian-speaking Wasm community
@lexfrl
lexfrl / Location.js
Last active September 17, 2016 18:19
An app entry point BEFORE React Router was "invented"
// The 'VIRTUAL' location bar
import React, { PropTypes } from "react";
import Logo from "../components/Logo";
import slots from "../slots";
const Location = React.createClass({
getInitialState() {
return {
pushState: true
@lexfrl
lexfrl / example.js
Last active September 12, 2016 13:48
React Overlay Impl (useful for Modals and Popovers)
import React, { PropTypes } from 'react'
import { OverlayMountPoint, OverlayView, OverlayToggle } from './overlay'
function somewhereOnTheTopOffTheAppTree() {
return (
<div>
<OverlayMountPoint /> // SnapshotsEditDialog will be rendered here
</div>
)
}
@lexfrl
lexfrl / graphql-shema-decorate-resolve.js
Created November 26, 2015 12:57
GraphQL Schema traverse + resolve decorate
let types = Schema.getTypeMap();
Object.keys(types).forEach((key) => {
let fields = types[key]._fields;
if (!fields) {
return;
}
Object.keys(fields).forEach((tKey) => {
let field = fields[tKey];
import r from "rethinkdb"
queries: {
user: ({ session }) => {
return r.table("users").get(session.userId)
},
results: ({route: {params: { id }}}) => {
return r.table("results").get(id)
}
}
@lexfrl
lexfrl / Link.js
Last active September 7, 2015 12:55
const ObjectID = mongodb.ObjectID;
var cacheVk = {};
/**
* @TODO: add token refresh logicб fallback ect
*/
export function vk (userId, db = null, f = null, collName = "users", tokPath = "vk.session.sid") {
let project = {};
project[tokPath] = 1;
Open /etc/sysctl.conf with:
sudo nano /etc/sysctl.conf
Scroll down to the last line of the file and add the line:
net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
server.use("/api", (req, res, next) => {
let route = router.match(req.url);
let service = null;
try {
service = require("./api/" + route.name.replace(".", "-"));
} catch (e) {
console.log(e.message);
res.status(404).send("Not Found");
return;
}