Skip to content

Instantly share code, notes, and snippets.

View joshbuchea's full-sized avatar

Josh Buchea joshbuchea

View GitHub Profile
@joshbuchea
joshbuchea / slugify.js
Created August 22, 2018 23:04 — forked from hagemann/slugify.js
Slugify makes a string URI-friendly
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 / react-example-bare-minimum.html
Last active June 27, 2018 21:57
React Example: Bare Minimum
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>React Example: Bare Minimum</title>
<link rel="icon" href="https://reactjs.org/favicon.ico" />
</head>
<body>
@joshbuchea
joshbuchea / meta-tags.md
Created April 15, 2016 23:44 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

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'>
@joshbuchea
joshbuchea / starter-styles.css
Last active March 29, 2018 23:47
Sensible CSS Styles
/******************************************************************************
* Page Defaults
*****************************************************************************/
/* Bootstrap 4 Reboot: https://getbootstrap.com/docs/4.0/content/reboot/ */
/* Bootstrap 4 Reboot CSS: https://github.com/twbs/bootstrap/blob/v4-dev/dist/css/bootstrap-reboot.css */
/* global box-sizing */
*,
*::before,
@joshbuchea
joshbuchea / suckData.js
Created January 22, 2018 01:18
HTML table data to JSON
/*
* 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 / random-password.php
Last active January 9, 2018 18:55
Generate random passwords
<?php
function random_password( $length = 8 ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
$password = substr( str_shuffle( $chars ), 0, $length );
return $password;
}
?>
@joshbuchea
joshbuchea / android-expansion-steps.md
Last active October 2, 2017 12:28
Steps to get cordova-plugin-xapkreader working with Ionic/Cordova 5 project
@joshbuchea
joshbuchea / index.js
Created July 21, 2017 04:16 — forked from stan229/index.js
React Navigation and Redux example
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);
<link rel="icon" type="image/png" sizes="192x192" href="/favicons/android-chrome-192x192.png">
{{^includesManifest}}
<link rel="manifest" href="/manifest.json">
{{/includesManifest}}
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#ffffff">
<meta name="application-name" content="AMP by Example">
<link rel="apple-touch-icon" sizes="57x57" href="/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/favicons/apple-touch-icon-72x72.png">
@joshbuchea
joshbuchea / web-servers.md
Created September 8, 2016 17:10 — forked from willurd/web-servers.md
Big list of http static server one-liners

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