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

#HTMLQuiz what happens?

<iframe id=x></iframe>
<script>
x.contentDocument.body.appendChild(x);
</script>
  • wild DOMException appears
  • iframe escapes
@joshbuchea
joshbuchea / decodeUrlParameter.js
Last active February 19, 2016 21:30 — forked from bchapuis/decodeUrlParameter.js
Replace the plus sign which encode spaces in GET parameters using javascript.
function decodeUrlParameter(str) {
return decodeURIComponent((str+'').replace(/\+/g, '%20'));
}
@joshbuchea
joshbuchea / publickey-git-error.markdown
Created February 17, 2016 18:53 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@joshbuchea
joshbuchea / 0_reuse_code.js
Last active August 29, 2015 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joshbuchea
joshbuchea / .gitignore
Last active August 29, 2015 14:26 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #