Skip to content

Instantly share code, notes, and snippets.

@ghostffcode
ghostffcode / useMySafes.tsx
Last active June 30, 2023 14:42
Hooks for interacting with user safes
import { useEffect, useState } from "react";
import { isAddress } from "viem";
import { useNetwork } from "wagmi";
interface Props {
address?: string;
chainId?: number;
}
const useMySafes = ({ address = "", chainId }: Props) => {
@ghostffcode
ghostffcode / BatchResolver.sol
Last active May 18, 2023 20:21
Batch Resolve ENS names to addresses
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
abstract contract Registry {
function resolver(bytes32 node) external view virtual returns (address);
}
abstract contract Resolver {
function addr(bytes32 node) external view virtual returns (address);
}
@ghostffcode
ghostffcode / cloudSettings
Last active October 20, 2019 20:31 — forked from Lavioli/cloudSettings
vs studio settings
{"lastUpload":"2019-10-20T20:31:36.574Z","extensionVersion":"v3.4.3"}
import React, { Component } from 'react'
import Firebase from 'firebase'
import ReactFireMixin from 'reactfire'
import reactMixin from 'react-mixin'
const ref = new Firebase('https://<APPNAME>.firebaseio.com/users')
class UsersList extends Component {
constructor (props, context) {
super(props, context)
@ghostffcode
ghostffcode / gist:d7626d6b9dbe51ac4ec21e5501292255
Created March 8, 2017 17:14 — forked from mattd/gist:1006398
nginx try_files with a proxy_pass
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
@ghostffcode
ghostffcode / editor.css
Created January 18, 2017 17:31 — forked from Hendrixer/editor.css
VS code custom CSS for theme
.composite-title, .composite-title, .vs-dark .monaco-workbench>.activitybar>.content {
background-color: rgba(40, 44, 52, 1) !important;
}
.tabs-container, .tab, .tab.active, .title-actions, .tablist, .tabs-container, .tabs, .composite.title {
background-color: rgba(40, 44, 52, 1) !important;
}
.tab.active, .tab {
border-right: 0px !important;
var arr = [1,2, 3, [4,5,6, [45,26,25,89]], 7,8,9]
function flatten(myArray) {
return myArray.reduce(function (x, y) {
return x.concat(Array.isArray(y) ? flatten(y) : y);
}, []);
}
console.log(flatten(arr));
@ghostffcode
ghostffcode / props.children.md
Created August 18, 2016 14:38
Simple Explanation Of React this.props.children

Say I have a route for react that looks like below route:

<Route path="/" component={Layout}>
  <IndexRoute component={home}></Route>
  <Route path="user" component={user}></Route>
</Route>

Where the Layout component has just the header and footer only but the main content of the webpage is loaded from the child routes. Home is the index route and /user renders the user route inside the Layout component. To display the content of the home or user component inside the Layout route, you need to include below code in the Layout route: