Skip to content

Instantly share code, notes, and snippets.

View x5engine's full-sized avatar
🎉
Winning

X5 Engine x5engine

🎉
Winning
View GitHub Profile
@addisonschultz
addisonschultz / useScript.tsx
Last active October 28, 2023 10:02
A React hook that lets you add script tags to a component. Useful when needing to load scripts for components in Framer X.
import * as React from "react"
import { useState, useEffect } from "react"
// Hook
let cachedScripts = []
export function useScript(src) {
// Keeping track of script loaded and error state
const [state, setState] = useState({
loaded: false,
@amcvitty
amcvitty / password_autofill_expo_how_to.md
Last active March 31, 2024 10:17
Configure Password Autofill on a React Native Expo app

Password Autofill on a React Native Expo app

Developing an app to accompany our website, worried that we would lose people in the transition if they couldn't remember their password, we were looking to make our app do Password AutoFill, a feature in iOS.

A talk from WWDC introducing the feature: https://developer.apple.com/videos/play/wwdc2017/206/

It works well, but there were a few bumps in the road making it work for React Native on Expo, so here are some notes to help out.

Apple's docs are here: https://developer.apple.com/documentation/security/password_autofill and they say something like this:

@0xCourtney
0xCourtney / App.js
Created August 13, 2018 01:51
Uploads file to IPFS via Infura
// Note this only shows the function being called in the parent component. The child component
// passes the event and contract address to the parent... I can make this more complete if requested...
uploadFile = async (event, contractAddress) => {
event.stopPropagation();
event.preventDefault();
const { web3, accounts } = this.state;
@carsonfarmer
carsonfarmer / default
Created June 18, 2018 22:59
Nginx config
server {
server_name ipfs.my-domain-name.com;
listen [::]:4002 ssl ipv6only=on;
listen 4002 ssl;
ssl_certificate /etc/letsencrypt/live/ipfs.my-domain-name.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ipfs.my-domain-name.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://127.0.0.1:8081;
@sulejirl
sulejirl / ethereum-backend.js
Last active February 14, 2023 21:13
Ethereum: Sending Transaction via NodeJS Backend Tutorial
const web3 = require('web3');
const express = require('express');
const Tx = require('ethereumjs-tx');
const app = express();
//Infura HttpProvider Endpoint
web3js = new web3(new web3.providers.HttpProvider("https://rinkeby.infura.io/YOUR_API_KEY"));
app.get('/sendtx',function(req,res){
@justsml
justsml / fetch-api-examples.md
Last active February 24, 2024 18:05
JavaScript Fetch API Examples
@princessjanf
princessjanf / locationA.js
Last active October 26, 2019 08:06
Final Code For React Native's Geolocation
import React, { Component } from "react";
import { AppRegistry, StyleSheet, Dimensions, Image, View, StatusBar, TouchableOpacity } from "react-native";
import { Container, Text } from "native-base";
import MapView from 'react-native-maps';
import Polyline from '@mapbox/polyline';
class LocationA extends Component {
constructor(props) {
@hamrammi
hamrammi / whatsapp-send-in-current-chat.js
Last active March 22, 2020 13:47 — forked from EyMaddis/whatsapp-send-in-current-chat.js
Sending messages programmatically on web.whatsapp.com
// this allows to send arbitrary messages. The chat conversation you want to send messages to has to be open.
// just run this in the JS console
// http://stackoverflow.com/a/39165137/1249001
function findChatComponent(dom) {
var result = null
for (var key in dom) {
if (key.startsWith("__reactInternalInstance$")) {
try {
result = dom[key].child.child.memoizedProps.children._owner.stateNode.props.chat
@codediodeio
codediodeio / database.rules.json
Last active January 28, 2024 19:07
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@EyMaddis
EyMaddis / whatsapp-send-in-current-chat.js
Created November 4, 2016 12:50
Sending messages programmatically on web.whatsapp.com
// this allows to send arbitrary messages. The chat conversation you want to send messages to has to be open.
// just run this in the JS console
// http://stackoverflow.com/a/39165137/1249001
function findReactComponent(dom) {
for (var key in dom)
if (key.startsWith("__reactInternalInstance$")) {
var compInternals = dom[key]._currentElement;
var compWrapper = compInternals._owner;
var comp = compWrapper._instance;