Skip to content

Instantly share code, notes, and snippets.

@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active April 18, 2024 01:00
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
@adamjohnson
adamjohnson / no-jquery-native-apis.md
Last active December 2, 2022 18:28
A list of "You might not need jQuery" / helpful native API's & methods.

A well designed vanilla JS resource:

https://codetogo.io/

☝️ Can search via method name or the task you want to accomplish.


A great list of commonly used native JS methods and API's:

@adamjohnson
adamjohnson / responsive_960grid.css
Created November 9, 2011 16:18
The Responsive 960 Grid System, Beta v0.6
/* Begin 960.css 12 and 16 column minified, 10-27-10 via 960-Grid-System at GitHub
* Licensed under GPL and MIT licenses, just like the original 960 Grid
* Adaptive media queries created by Adam Johnson. @adamj_design | http://adamjohnsondesign.com
*/
body{min-width:960px}.container_12,.container_16,.container_24{margin-left:auto;margin-right:auto;width:960px}.grid_1,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9,.grid_10,.grid_11,.grid_12,.grid_13,.grid_14,.grid_15,.grid_16,.grid_17,.grid_18,.grid_19,.grid_20,.grid_21,.grid_22,.grid_23,.grid_24{display:inline;float:left;margin-left:10px;margin-right:10px}.push_1,.pull_1,.push_2,.pull_2,.push_3,.pull_3,.push_4,.pull_4,.push_5,.pull_5,.push_6,.pull_6,.push_7,.pull_7,.push_8,.pull_8,.push_9,.pull_9,.push_10,.pull_10,.push_11,.pull_11,.push_12,.pull_12,.push_13,.pull_13,.push_14,.pull_14,.push_15,.pull_15{position:relative}.container_12 .grid_3,.container_16 .grid_4{width:220px}.container_12 .grid_6,.container_16 .grid_8{width:460px}.containe
@adamjohnson
adamjohnson / google-apps-script-google-sheets-json-api.js
Created January 6, 2021 23:06
The code to get Google Apps Script to create a JSON API from a Google Spreadsheet (code from video: https://www.youtube.com/watch?v=3OakodfKjrU + comments).
// Script from: https://www.youtube.com/watch?v=3OakodfKjrU
function doGet (request) {
var query = request.parameter.q; // If you want to search for specific data, append ?q=my-string-to-search-for
var parameters = 2; // The number of columns in your spreadsheet.
var sheetname = 'Sheet1'; // TODO: Change this to the name of the sheet you want to target.
var doc = SpreadsheetApp.openById(PropertiesService.getScriptProperties().getProperty('key')); // NOTE: 'key' must be the same up here as it is down below in setup();
var sheet = doc.getSheetByName(sheetname);
var lastrow = sheet.getLastRow();
var rows = []; // The array we're going to push our data to.
@adamjohnson
adamjohnson / sublime-packages.md
Last active January 6, 2022 19:13
My Sublime Text Packages

My Sublime Text 3 Packages

As of 1/6/2022

  • Align Tab
  • All Autocomplete
  • Better CoffeeScript
  • BootstrapAutocomplete
  • Clickable URLs
  • Default File Type
@adamjohnson
adamjohnson / reusable-fetch-functions.js
Last active December 21, 2021 18:33
Reusable JavaScript fetch functions for JSON GET requests
/*
Reusable `fetch` functions for JSON GET requests
Examples in ES8 & ES5+ for older browser support
*/
'use strict';
const endpoint = 'https://api.chucknorris.io/jokes/random';
// The reusable ES2017 (ES8) function (GET requests & JSON only):
@adamjohnson
adamjohnson / google-calendar.html
Last active August 13, 2021 15:00
Pull events from a public Google Calendar using the Google Calendar API. Based off of: https://stackoverflow.com/a/56496854/908059
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Google Calendar API</title>
</head>
<body>
<h1>Events:</h1>
<div id="js-gcal-event">
<!-- SVG loader By Sam Herbert (@sherb). http://goo.gl/7AJzbL -->
@adamjohnson
adamjohnson / liquid_comment.sublime-snippet
Last active January 29, 2021 23:45
A collection of Liquid Snippets for CleanSlate CMS + Sublime Text 3.
<snippet>
<!-- Snippet to insert a Liquid comment for CleanSlate. -->
<content><![CDATA[
{% comment %}
${1:}
{% endcomment %}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>lqcomment</tabTrigger>
<description>Liquid Comment</description>
@adamjohnson
adamjohnson / Preferences.sublime-settings
Last active December 11, 2020 17:27
My Sublime Text User Preferences
{
"always_show_minimap_viewport": true,
"binary_file_patterns":
[
"node_modules/**",
"bower_components/**"
],
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
"fade_fold_buttons": false,
@adamjohnson
adamjohnson / dot-join-with-newline-as-argument.js
Created November 30, 2020 21:41
Using the newline character with the .join() method in JavaScript to combine a string.
let myString = [
'<div class="container">',
'<h2>This is inserted via JS:</h2>',
'<p>',
'The .join() method can accept newline as an argument.',
'Much better than +!',
'</p>',
'</div>'
].join('\n'); // <-- 🎉