Skip to content

Instantly share code, notes, and snippets.

View asuh's full-sized avatar

Micah asuh

View GitHub Profile
@asuh
asuh / gist:7d3dc277ecdc7d654d8c681bc1b281d3
Created September 14, 2023 23:40
Defensive Fetch Response
async function getGithubProfile(username) {
let response;
try {
response = await fetch(`https://api.github.com/users/${username}`);
} catch (error) {
throw new Error(`Network error: ${error.message}`);
}
if (!response.ok) {
const message = `HTTP error! status: ${response.status}`;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Code Sandbox</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
/*
* Fluid Typography
* https://smashingmagazine.com/2022/10/fluid-typography-clamp-sass-functions/
*/
@use 'sass:math';
$default-min-bp: 320px;
$default-max-bp: 960px;
@asuh
asuh / filter-wc-orders-by-gateway.php
Created July 21, 2019 21:26 — forked from bekarice/filter-wc-orders-by-gateway.php
Filters WooCommerce Orders by Payment Gateway Used
<?php
/**
* Plugin Name: Filter WooCommerce Orders by Payment Method
* Plugin URI: http://skyverge.com/
* Description: Filters WooCommerce orders by the payment method used :)
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-filter-orders-by-payment
*
@asuh
asuh / boxstarter.ps1
Last active October 30, 2018 14:29 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <[email protected]>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@asuh
asuh / comments.php
Created May 27, 2018 20:09
Walker_Comment overwrite for WordPress
<?php
class comments_reloaded extends \Walker_Comment {
var $tree_type = 'comment';
var $db_fields = array(
'parent' => 'comment_parent',
'id' => 'comment_ID'
);
// start_lvl – Wrapper for child comments list, starts the list before the elements are added.

Keybase proof

I hereby claim:

  • I am asuh on github.
  • I am asuh (https://keybase.io/asuh) on keybase.
  • I have a public key ASA5GySldrdOvSxhRE_sFiMC-3aayiBOE3cHASzXvr0Kwwo

To claim this, I am signing this object:

@asuh
asuh / package.json
Last active December 19, 2019 21:11
NPM only, no Grunt, Gulp, Broccoli or Brunch
{
"name": "_s",
"version": "1.0.1",
"scripts": {
"clean": "rimraf style.css",
"notify": "notify -h",
"serve": "browser-sync start --proxy 'my.asuh' --files '**/*.css, **/*.js, *.php, **/*.json, dist/images/*'",
"imagemin": "imagemin src/images/* -o dist/images",
"icons": "svgo -f src/images/icons -o dist/images/icons && svg-sprite-generate -d dist/images/icons -o dist/images/icons/sprite.svg",
"lint-scss": "stylelint 'sass/**/*.scss' --syntax scss --config node_modules/stylelint-config-wordpress/scss.js",
@asuh
asuh / templating.js
Last active December 10, 2016 08:39
JS templating system
'use strict';
/*
* Javascript templating system
*/
$(document).ready(function() {
function loadTemplate(element, path, callback, done) {
$.ajax(path).then(function(html) {
element.append(html);
if (typeof callback === 'function' ) {
@asuh
asuh / Preferences.sublime-settings
Last active November 17, 2022 18:53
Sublime Text 3 User Preferences sublime-settings file
{
"always_show_minimap_viewport": true,
// Using ⌘-P, these files will never be shown in results
"binary_file_patterns":
[
"*.ai",
"*.dds",
"*.eot",
"*.gif",
"*.ico",