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 / 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

@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) {
# -*- coding=utf-8 -*-
import Queue
import functools
import logging
import os
import re
import sys
import time
from functools import partial
from itertools import repeat
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby