Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ryan Wu ryanhanwu

🎯
Focusing
View GitHub Profile
@ryanhanwu
ryanhanwu / mapViewController.m
Last active Nov 4, 2022
Calculate Google Map length in meters with zoom level in #Objective-C (converted from #JavaScript) #iOS #Swift
View mapViewController.m
- (void)mapView:(GMSMapView*)mapView idleAtCameraPosition:(GMSCameraPosition*)position
{
CLLocationCoordinate2D topLeft = mapView.projection.visibleRegion.farLeft;
CLLocationCoordinate2D bottomLeft = mapView.projection.visibleRegion.nearLeft;
double lat = fabs(topLeft.latitude - bottomLeft.latitude);
double mpp = cos(lat * M_PI / 180) * 2 * M_PI * 6378137 / (256 * pow(2, mapView.camera.zoom));
double distance = mpp * mapView.frame.size.width;
[[SearchManager shareInstance] distance: distance];
}
@ryanhanwu
ryanhanwu / Brewfile
Last active Nov 4, 2022
New Mac Setup Script 2021
View Brewfile
# Taps
tap 'homebrew/cask-fonts'
tap 'homebrew/cask-versions'
tap 'heroku/brew'
# Install CLI Tools
## Shell Utilities
brew 'coreutils'
brew 'findutils'
brew 'autojump'
@ryanhanwu
ryanhanwu / index.js
Created Jan 22, 2021
A gist for first Tailwind CSS page
View index.js
export default function Home() {
return (
<main className="container mx-auto px-4">
<div>
<section className="py-12 px-4 text-center">
<div className="w-full max-w-2xl mx-auto">
<span className="text-sm font-semibold">Next.js + Tailwind CSS + Firebase Cloud Functions + Github Actions</span>
< h2 className = "text-5xl mt-2 mb-6 leading-tight font-semibold font-heading" >Project Header</h2>
<a className="text-indigo-600 hover:underline" href="#">Learn more &raquo;</a>
</div>
@ryanhanwu
ryanhanwu / ipad.css
Created Aug 30, 2012
ipad specific css (responsive)
View ipad.css
@media only screen and (device-width: 768px) {
/* For general iPad layouts */
}
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {
/* For portrait layouts only */
}
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
/* For landscape layouts only */
@ryanhanwu
ryanhanwu / httpsExpressApp.js
Created Apr 5, 2013
Express JS HTTP + HTTPs server (including auto redirect)
View httpsExpressApp.js
var express = require('express'),
routes = require('./routes'),
upload = require('./routes/upload'),
http = require('http'),
https = require('https'),
fs = require('fs'),
path = require('path'),
httpApp = express(),
app = express(),
certPath = "cert";
@ryanhanwu
ryanhanwu / cloudSettings
Last active Apr 27, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-04-27T14:20:49.226Z","extensionVersion":"v3.4.3"}
@ryanhanwu
ryanhanwu / myViewController.h
Created Dec 6, 2012
[iOS] Get current location and city name
View myViewController.h
@interface myViewController: UIViewController <CLLocationManagerDelegate>
CLLocationManager *locationManager;
CLLocation *currentLocation;
@end
@ryanhanwu
ryanhanwu / .env
Created Feb 23, 2021 — forked from joshdholtz/.env
Using Dotenv and environment variables with fastlane
View .env
STUFF = this is some stuff
View MinHeap.js
class MinHeap {
constructor() {
this.heap = [];
}
getMin() {
return this.heap[0];
}
insert(node) {
/* Inserting the new node at the end of the heap array */
this.heap.push(node);
@ryanhanwu
ryanhanwu / Fastfile
Created Feb 2, 2021
Build React Native Android App and submit to Firebase App Distribution via Github Actions
View Fastfile
default_platform(:android)
platform :android do
desc "Deploy a new version to the Firebase App Distribution"
lane :beta_ci do
gradle(task: "clean assembleRelease")
firebase_app_distribution(
app: "1:123123123123123123123", #https://console.firebase.google.com/u/2/project/
service_credentials_file: "./firebase-app-distribution.json", # Created from android_workflow.yml steps