Skip to content

Instantly share code, notes, and snippets.

@872409
872409 / distance-sample.php
Created March 1, 2023 08:47 — forked from LucaRosaldi/distance-sample.php
PHP: Get Distance Between two Geolocated Points (lat/lon)
<?php
/* These are two points in New York City */
$point1 = array('lat' => 40.770623, 'long' => -73.964367);
$point2 = array('lat' => 40.758224, 'long' => -73.917404);
$distance = getDistanceBetweenPoints($point1['lat'], $point1['long'], $point2['lat'], $point2['long']);
foreach ($distance as $unit => $value) {
echo $unit.': '.number_format($value,4).'<br />';
}
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
pragma experimental ABIEncoderV2;
contract Wallet {
address[] public approvers;
uint8 public quorum;
struct Transfer {
@872409
872409 / MultiSwap.sol
Created December 2, 2021 07:53 — forked from gorgos/MultiSwap.sol
Example for how to swap multiple tokens in one on Ropsten
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol";
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/IQuoter.sol";
import {IERC20, SafeERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol";
interface IUniswapRouter is ISwapRouter {
@872409
872409 / ballot.sol
Last active September 13, 2018 06:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
@872409
872409 / HorizontalPicker.js
Created June 13, 2018 13:34 — forked from jevakallio/HorizontalPicker.js
React Native Horizontal Picker
// @flow
// https://twitter.com/jevakallio/status/941258932529614848
import React, { Component, type Node } from 'react';
import styled from 'styled-components/native';
import Touchable from 'react-native-platform-touchable';
import Carousel from 'react-native-snap-carousel';
// $FlowFixMe
import { LinearGradient } from 'expo';
@872409
872409 / how-to-use-web3-with-react-native.md
Created May 11, 2018 05:08
This file describes how to set up the Ethereum JS API web3.js with the boilerplate Create React Native App

How to set up web3.js with CRNA

This is a simple guide to get you started with using the Ethereum Javascript API (web3.js) with the Create React Native App project. This is not an in-depth guide.

  1. Make sure you have Node version 6 or later installed, if not, get it on the Node website

    node --version

  2. Install Create React Native App

0499337577c5792125e91f84232d1f3af7a53dee19f2946504ff8d4e14986d371388a21766e8ba10352c193c764ad0f2f96ffb0422d1cde62fb30f2371660502df discountry
@872409
872409 / DbfInputStream2.java
Created March 6, 2017 02:25 — forked from kiichi/DbfInputStream2.java
ShapeFile in Android Demo using OpenMap Library. Reading .shp and .dbf files after extracting the zip file into the external storage area. Learn Android Programming in our Online Course http://liu.edu/gis/
package edu.liu.shapefileexample;
// Note:
// This is my modified version for educational purpose by Kiichi Takeuchi. I removed swing dependency and changed class name.
//
// **********************************************************************
//
// <copyright>
//
@872409
872409 / CHexConver.java
Created February 16, 2017 08:59 — forked from alanland/CHexConver.java
java 中 Hex的转换
package mobi.dzs.util;
/**
* 16进制值与String/Byte之间的转换
* @author JerryLi
* @email lijian@dzs.mobi
* @data 2011-10-16
* */
public class CHexConver
{
(function() {
var Ap = Array.prototype;
var slice = Ap.slice;
var Fp = Function.prototype;
if (!Fp.bind) {
// PhantomJS doesn't support Function.prototype.bind natively, so
// polyfill it whenever this module is required.
Fp.bind = function(context) {