Skip to content

Instantly share code, notes, and snippets.

View joshbuchea's full-sized avatar

Josh Buchea joshbuchea

View GitHub Profile
@joshbuchea
joshbuchea / force-lowercase-urls.php
Created October 18, 2015 06:28
A function to redirect uppercase URLs to lowercase.
/**
* Changes the requested URL to lowercase.
*
* Only if URL does not include a filename or query variable.
*/
function force_lowercase_urls() {
// Grab requested URL
$url = $_SERVER['REQUEST_URI'];
// If URL contains a period, halt (likely contains a filename and filenames are case specific)
if ( preg_match('/[\.]/', $url) ) {
@joshbuchea
joshbuchea / select-1-100.html
Last active July 15, 2022 17:16
A select box with options 1–100
<select>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
@joshbuchea
joshbuchea / .env
Created May 14, 2022 01:22 — forked from joshdholtz/.env
Using Dotenv and environment variables with fastlane
STUFF = this is some stuff
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
// https://stackoverflow.com/a/57280180/1492782
@Environment(\.colorScheme) var colorScheme: ColorScheme
var body: some View {
Button(action: {
foo()
}) {
Image(colorScheme == .light ? "lightImage" : "darkImage")
}
}
@joshbuchea
joshbuchea / cloudSettings
Last active April 1, 2020 03:33
cloudSettings
{"lastUpload":"2020-04-01T03:33:25.122Z","extensionVersion":"v3.4.3"}
@joshbuchea
joshbuchea / ios.settings.schemes.md
Created March 11, 2020 00:39 — forked from tzmartin/ios.settings.schemes.md
iOS Settings URL Scheme List

Settings URL schemes:

Note: < i=OS 5.1 use prefs:. > 5.1 use app-settings:

  • app-settings:root=General&path=About
  • app-settings:root=General&path=ACCESSIBILITY
  • app-settings:root=AIRPLANE_MODE
  • app-settings:root=General&path=AUTOLOCK
  • app-settings:root=General&path=USAGE/CELLULAR_USAGE
  • app-settings:root=Brightness
@joshbuchea
joshbuchea / gist:e769eb87b6f462af8d71fcebc30c7061
Created May 19, 2016 18:19 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@joshbuchea
joshbuchea / HOWTO.md
Created June 21, 2017 00:45 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
<html>
<head>
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
</head>
<body>
<div id="map" style="height: 400px; width: 500px;">
</div>
<script type="text/javascript">