Skip to content

Instantly share code, notes, and snippets.

Josh Buchea joshbuchea

Block or report user

Report or block joshbuchea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshbuchea
joshbuchea / mac-setup.sh
Created Aug 8, 2019 — forked from matteocrippa/mac-setup.sh
a script to quick setup my dev Mac
View mac-setup.sh
#!/usr/bin/env bash
echo "Install XCode first"
xcode-select --install
# Setup directories
mkdir ~/Projects
mkdir ~/Projects/Repositories
mkdir ~/Projects/Material
@joshbuchea
joshbuchea / slugify.js
Created Aug 22, 2018 — forked from hagemann/slugify.js
Slugify makes a string URI-friendly
View slugify.js
function slugify(string) {
const a = 'àáäâãåèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;'
const b = 'aaaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
@joshbuchea
joshbuchea / suckData.js
Created Jan 22, 2018 — forked from Frondor/suckData.js
HTML table data to JSON
View suckData.js
/*
* THIS IS NOT A PLUGIN
* ~ but a personal snippet
*
* Sometimes when prototyping my designs, I like to get dummy data pretty fast.
* I use this snippet to extract that data from working (aka "real life") tables from other HTML tables I find on the net.
* So I'll need that same data but inside an object.
*
* This script assumes by default the table has the following structure:
* <table>
@joshbuchea
joshbuchea / index.js
Created Jul 21, 2017 — forked from stan229/index.js
React Navigation and Redux example
View index.js
import React, { Component } from "react";
import { Text } from "react-native";
import { Provider, connect } from "react-redux";
import { StackNavigator, addNavigationHelpers } from "react-navigation";
import Routes from "./config/routes";
import getStore from "./store";
const AppNavigator = StackNavigator(Routes);
@joshbuchea
joshbuchea / HOWTO.md
Created Jun 21, 2017 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default
View HOWTO.md

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
@joshbuchea
joshbuchea / htmlquiz-iframe-escape.md
Created Sep 20, 2016 — forked from zcorpan/htmlquiz-iframe-escape.md
#HTMLQuiz what happens (iframe escape)
View htmlquiz-iframe-escape.md

#HTMLQuiz what happens?

<iframe id=x></iframe>
<script>
x.contentDocument.body.appendChild(x);
</script>
  • wild DOMException appears
  • iframe escapes
@joshbuchea
joshbuchea / web-servers.md
Created Sep 8, 2016 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
View Google Maps Simple Multiple Marker Example
<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">
@joshbuchea
joshbuchea / gist:e769eb87b6f462af8d71fcebc30c7061
Created May 19, 2016 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs
View gist:e769eb87b6f462af8d71fcebc30c7061

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 / meta-tags.md
Created Apr 15, 2016 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags
View meta-tags.md

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
You can’t perform that action at this time.