Skip to content

Instantly share code, notes, and snippets.

View dmamills's full-sized avatar
💭
ya yr smart but you'll never b dolphin smart

dmamills

💭
ya yr smart but you'll never b dolphin smart
View GitHub Profile
double distance_on_geoid(double lat1, double lon1, double lat2, double lon2) {
// Convert degrees to radians
lat1 = lat1 * M_PI / 180.0;
lon1 = lon1 * M_PI / 180.0;
lat2 = lat2 * M_PI / 180.0;
lon2 = lon2 * M_PI / 180.0;
// radius of earth in metres
@dmamills
dmamills / recording-animation-example.swift
Last active February 17, 2023 13:28
Swift 3 Example Animation
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
var touchView = UIView()
var outerCircle = UIView()
var innerCircle = UIView()
@dmamills
dmamills / example.js
Created August 22, 2017 13:25
Open/Close react-native animation example
import React, { Component } from "react";
import { AppRegistry, StyleSheet, Text, Dimensions, View, Animated, TouchableWithoutFeedback } from "react-native";
export default class animations extends Component {
state = {
played: false,
text: 'Welcome!',
animation: new Animated.Value(50),
a2: new Animated.Value(50),
at: new Animated.Value(0),
@dmamills
dmamills / SwiftTacToe.swift
Created July 7, 2017 02:06
swift 3 playground tic-tac-toe
import UIKit
import PlaygroundSupport
class SwiftTacToe {
var spaces = [0, 0, 0, 0, 0, 0, 0, 0, 0 ]
var xTurn = true
var spaceViews : [UIView] = []
var mainView : UIView
@dmamills
dmamills / index.html
Created May 29, 2017 02:23
JS Bin extremely simple pull-streams example // source http://jsbin.com/redodazigu
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="extremely simple pull-streams example">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const logger = require('morgan');
const multipart = require('connect-multiparty');
const fs = require('fs');
const shortid = require('shortid');
let app = express();
@dmamills
dmamills / ScreenshotDetector.swift
Created April 7, 2017 13:12 — forked from ts95/ScreenshotDetector.swift
OS X detect new screenshot event with Swift
import Foundation
typealias NewFileCallback = (fileURL: NSURL) -> Void
class ScreenshotDetector: NSObject, NSMetadataQueryDelegate {
let query = NSMetadataQuery()
var newFileCallback: NewFileCallback?
let f1 = (() => {
var _ref = _asyncToGenerator(function*() {
console.log('start spinner');
try {
var x = yield resolveAfter2Seconds(10);
console.log('stop spinner');
console.log(x); // 10
} catch (e) {
console.log('stop spinner');
console.log(e);
//Original
const makeRequest = () => {
return getJSON()
.then(data => {
if (data.needsAnotherRequest) {
return makeAnotherRequest(data)
.then(moreData => {
console.log(moreData)
return moreData
})
const makeRequest = () => {
return getJSON()
.then(data => {
if (data.needsAnotherRequest) {
return makeAnotherRequest(data)
.then(moreData => {
console.log(moreData)
return moreData
})
} else {